Share via


Microsoft.DocumentDB databaseAccounts/services 2021-04-01-preview

Bicep resource definition

The databaseAccounts/services resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.DocumentDB/databaseAccounts/services resource, add the following Bicep to your template.

resource symbolicname 'Microsoft.DocumentDB/databaseAccounts/services@2021-04-01-preview' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    instanceCount: int
    instanceSize: 'string'
  }
}

Property Values

Microsoft.DocumentDB/databaseAccounts/services

Name Description Value
name The resource name string

Constraints:
Min length = 3
Max length = 50 (required)
parent In Bicep, you can specify the parent resource for a child resource. You only need to add this property when the child resource is declared outside of the parent resource.

For more information, see Child resource outside parent resource.
Symbolic name for resource of type: databaseAccounts
properties Properties in ServiceResourceCreateUpdateParameters. ServiceResourceCreateUpdatePropertiesOrServiceResourceProperties

ServiceResourceCreateUpdatePropertiesOrServiceResourceProperties

Name Description Value
instanceCount Instance count for the service. int

Constraints:
Min value = 0
instanceSize Instance type for the service. 'Cosmos.D16s'
'Cosmos.D4s'
'Cosmos.D8s'

ARM template resource definition

The databaseAccounts/services resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.DocumentDB/databaseAccounts/services resource, add the following JSON to your template.

{
  "type": "Microsoft.DocumentDB/databaseAccounts/services",
  "apiVersion": "2021-04-01-preview",
  "name": "string",
  "properties": {
    "instanceCount": "int",
    "instanceSize": "string"
  }
}

Property Values

Microsoft.DocumentDB/databaseAccounts/services

Name Description Value
apiVersion The api version '2021-04-01-preview'
name The resource name string

Constraints:
Min length = 3
Max length = 50 (required)
properties Properties in ServiceResourceCreateUpdateParameters. ServiceResourceCreateUpdatePropertiesOrServiceResourceProperties
type The resource type 'Microsoft.DocumentDB/databaseAccounts/services'

ServiceResourceCreateUpdatePropertiesOrServiceResourceProperties

Name Description Value
instanceCount Instance count for the service. int

Constraints:
Min value = 0
instanceSize Instance type for the service. 'Cosmos.D16s'
'Cosmos.D4s'
'Cosmos.D8s'

Usage Examples

Terraform (AzAPI provider) resource definition

The databaseAccounts/services resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a Microsoft.DocumentDB/databaseAccounts/services resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.DocumentDB/databaseAccounts/services@2021-04-01-preview"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      instanceCount = int
      instanceSize = "string"
    }
  }
}

Property Values

Microsoft.DocumentDB/databaseAccounts/services

Name Description Value
name The resource name string

Constraints:
Min length = 3
Max length = 50 (required)
parent_id The ID of the resource that is the parent for this resource. ID for resource of type: databaseAccounts
properties Properties in ServiceResourceCreateUpdateParameters. ServiceResourceCreateUpdatePropertiesOrServiceResourceProperties
type The resource type "Microsoft.DocumentDB/databaseAccounts/services@2021-04-01-preview"

ServiceResourceCreateUpdatePropertiesOrServiceResourceProperties

Name Description Value
instanceCount Instance count for the service. int

Constraints:
Min value = 0
instanceSize Instance type for the service. 'Cosmos.D16s'
'Cosmos.D4s'
'Cosmos.D8s'

Usage Examples

Terraform Samples

A basic example of deploying SQL Dedicated Gateway within a Cosmos DB Account.

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "___location" {
  type    = string
  default = "westeurope"
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  ___location = var.___location
}

resource "azapi_resource" "databaseAccount" {
  type      = "Microsoft.DocumentDB/databaseAccounts@2021-10-15"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  ___location  = var.___location
  body = {
    kind = "GlobalDocumentDB"
    properties = {
      capabilities = [
      ]
      consistencyPolicy = {
        defaultConsistencyLevel = "BoundedStaleness"
        maxIntervalInSeconds    = 5
        maxStalenessPrefix      = 100
      }
      databaseAccountOfferType           = "Standard"
      defaultIdentity                    = "FirstPartyIdentity"
      disableKeyBasedMetadataWriteAccess = false
      disableLocalAuth                   = false
      enableAnalyticalStorage            = false
      enableAutomaticFailover            = false
      enableFreeTier                     = false
      enableMultipleWriteLocations       = false
      ipRules = [
      ]
      isVirtualNetworkFilterEnabled = false
      locations = [
        {
          failoverPriority = 0
          isZoneRedundant  = false
          locationName     = "West Europe"
        },
      ]
      networkAclBypass = "None"
      networkAclBypassResourceIds = [
      ]
      publicNetworkAccess = "Enabled"
      virtualNetworkRules = [
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "service" {
  type      = "Microsoft.DocumentDB/databaseAccounts/services@2022-05-15"
  parent_id = azapi_resource.databaseAccount.id
  name      = "SqlDedicatedGateway"
  body = {
    properties = {
      instanceCount = 1
      instanceSize  = "Cosmos.D4s"
      serviceType   = "SqlDedicatedGateway"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}