Microsoft.DocumentDB databaseAccounts/services

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.

Usage Examples

Bicep Samples

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

param resourceName string = 'acctest0001'
param location string = 'westeurope'

resource databaseAccount 'Microsoft.DocumentDB/databaseAccounts@2021-10-15' = {
  name: resourceName
  location: location
  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: []
  }
}

resource service 'Microsoft.DocumentDB/databaseAccounts/services@2022-05-15' = {
  name: 'SqlDedicatedGateway'
  parent: databaseAccount
  properties: {
    instanceCount: 1
    instanceSize: 'Cosmos.D4s'
    serviceType: 'SqlDedicatedGateway'
  }
}

Resource format

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

resource symbolicname 'Microsoft.DocumentDB/databaseAccounts/services@2026-04-01-preview' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    instanceCount: int
    instanceSize: 'string'
    serviceType: 'string'
    // For remaining properties, see ServiceResourceProperties objects
  }
}

ServiceResourceProperties objects

Set the serviceType property to specify the type of object.

For DataTransfer, use:

{
  instanceCount: int
  instanceSize: 'string'
  serviceType: 'DataTransfer'
}

For SqlDedicatedGateway, use:

{
  dedicatedGatewayType: 'string'
  instanceCount: int
  instanceSize: 'string'
  serviceType: 'SqlDedicatedGateway'
  sqlDedicatedGatewayEndpoint: 'string'
}

For GraphAPICompute, use:

{
  graphApiComputeEndpoint: 'string'
  instanceCount: int
  instanceSize: 'string'
  serviceType: 'GraphAPICompute'
}

For MaterializedViewsBuilder, use:

{
  instanceCount: int
  instanceSize: 'string'
  serviceType: 'MaterializedViewsBuilder'
}

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 Services response resource. ServiceResourceProperties

DataTransferServiceResourceProperties

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'
serviceType ServiceType for the service. 'DataTransfer' (required)

GraphAPIComputeServiceResourceProperties

Name Description Value
graphApiComputeEndpoint GraphAPICompute endpoint for the service. string
instanceCount Instance count for the service. int

Constraints:
Min value = 0
instanceSize Instance type for the service. 'Cosmos.D16s'
'Cosmos.D4s'
'Cosmos.D8s'
serviceType ServiceType for the service. 'GraphAPICompute' (required)

MaterializedViewsBuilderServiceResourceProperties

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'
serviceType ServiceType for the service. 'MaterializedViewsBuilder' (required)

ServiceResourceProperties

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'
serviceType Set to 'DataTransfer' for type DataTransferServiceResourceProperties. Set to 'SqlDedicatedGateway' for type SqlDedicatedGatewayServiceResourceProperties. Set to 'GraphAPICompute' for type GraphAPIComputeServiceResourceProperties. Set to 'MaterializedViewsBuilder' for type MaterializedViewsBuilderServiceResourceProperties. 'DataTransfer'
'GraphAPICompute'
'MaterializedViewsBuilder'
'SqlDedicatedGateway' (required)

SqlDedicatedGatewayServiceResourceProperties

Name Description Value
dedicatedGatewayType DedicatedGatewayType for the service. 'DistributedQuery'
'IntegratedCache'
instanceCount Instance count for the service. int

Constraints:
Min value = 0
instanceSize Instance type for the service. 'Cosmos.D16s'
'Cosmos.D4s'
'Cosmos.D8s'
serviceType ServiceType for the service. 'SqlDedicatedGateway' (required)
sqlDedicatedGatewayEndpoint SqlDedicatedGateway endpoint for the service. string

ARM template resource definition

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

Usage Examples

Resource format

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

{
  "type": "Microsoft.DocumentDB/databaseAccounts/services",
  "apiVersion": "2026-04-01-preview",
  "name": "string",
  "properties": {
    "instanceCount": "int",
    "instanceSize": "string",
    "serviceType": "string"
    // For remaining properties, see ServiceResourceProperties objects
  }
}

ServiceResourceProperties objects

Set the serviceType property to specify the type of object.

For DataTransfer, use:

{
  "instanceCount": "int",
  "instanceSize": "string",
  "serviceType": "DataTransfer"
}

For SqlDedicatedGateway, use:

{
  "dedicatedGatewayType": "string",
  "instanceCount": "int",
  "instanceSize": "string",
  "serviceType": "SqlDedicatedGateway",
  "sqlDedicatedGatewayEndpoint": "string"
}

For GraphAPICompute, use:

{
  "graphApiComputeEndpoint": "string",
  "instanceCount": "int",
  "instanceSize": "string",
  "serviceType": "GraphAPICompute"
}

For MaterializedViewsBuilder, use:

{
  "instanceCount": "int",
  "instanceSize": "string",
  "serviceType": "MaterializedViewsBuilder"
}

Property Values

Microsoft.DocumentDB/databaseAccounts/services

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

Constraints:
Min length = 3
Max length = 50 (required)
properties Services response resource. ServiceResourceProperties
type The resource type 'Microsoft.DocumentDB/databaseAccounts/services'

DataTransferServiceResourceProperties

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'
serviceType ServiceType for the service. 'DataTransfer' (required)

GraphAPIComputeServiceResourceProperties

Name Description Value
graphApiComputeEndpoint GraphAPICompute endpoint for the service. string
instanceCount Instance count for the service. int

Constraints:
Min value = 0
instanceSize Instance type for the service. 'Cosmos.D16s'
'Cosmos.D4s'
'Cosmos.D8s'
serviceType ServiceType for the service. 'GraphAPICompute' (required)

MaterializedViewsBuilderServiceResourceProperties

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'
serviceType ServiceType for the service. 'MaterializedViewsBuilder' (required)

ServiceResourceProperties

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'
serviceType Set to 'DataTransfer' for type DataTransferServiceResourceProperties. Set to 'SqlDedicatedGateway' for type SqlDedicatedGatewayServiceResourceProperties. Set to 'GraphAPICompute' for type GraphAPIComputeServiceResourceProperties. Set to 'MaterializedViewsBuilder' for type MaterializedViewsBuilderServiceResourceProperties. 'DataTransfer'
'GraphAPICompute'
'MaterializedViewsBuilder'
'SqlDedicatedGateway' (required)

SqlDedicatedGatewayServiceResourceProperties

Name Description Value
dedicatedGatewayType DedicatedGatewayType for the service. 'DistributedQuery'
'IntegratedCache'
instanceCount Instance count for the service. int

Constraints:
Min value = 0
instanceSize Instance type for the service. 'Cosmos.D16s'
'Cosmos.D4s'
'Cosmos.D8s'
serviceType ServiceType for the service. 'SqlDedicatedGateway' (required)
sqlDedicatedGatewayEndpoint SqlDedicatedGateway endpoint for the service. string

Terraform (AzAPI provider) resource definition

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

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

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    = ["*"]
}

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@2026-04-01-preview"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      instanceCount = int
      instanceSize = "string"
      serviceType = "string"
      // For remaining properties, see ServiceResourceProperties objects
    }
  }
}

ServiceResourceProperties objects

Set the serviceType property to specify the type of object.

For DataTransfer, use:

{
  instanceCount = int
  instanceSize = "string"
  serviceType = "DataTransfer"
}

For SqlDedicatedGateway, use:

{
  dedicatedGatewayType = "string"
  instanceCount = int
  instanceSize = "string"
  serviceType = "SqlDedicatedGateway"
  sqlDedicatedGatewayEndpoint = "string"
}

For GraphAPICompute, use:

{
  graphApiComputeEndpoint = "string"
  instanceCount = int
  instanceSize = "string"
  serviceType = "GraphAPICompute"
}

For MaterializedViewsBuilder, use:

{
  instanceCount = int
  instanceSize = "string"
  serviceType = "MaterializedViewsBuilder"
}

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 Services response resource. ServiceResourceProperties
type The resource type "Microsoft.DocumentDB/databaseAccounts/services@2026-04-01-preview"

DataTransferServiceResourceProperties

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'
serviceType ServiceType for the service. 'DataTransfer' (required)

GraphAPIComputeServiceResourceProperties

Name Description Value
graphApiComputeEndpoint GraphAPICompute endpoint for the service. string
instanceCount Instance count for the service. int

Constraints:
Min value = 0
instanceSize Instance type for the service. 'Cosmos.D16s'
'Cosmos.D4s'
'Cosmos.D8s'
serviceType ServiceType for the service. 'GraphAPICompute' (required)

MaterializedViewsBuilderServiceResourceProperties

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'
serviceType ServiceType for the service. 'MaterializedViewsBuilder' (required)

ServiceResourceProperties

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'
serviceType Set to 'DataTransfer' for type DataTransferServiceResourceProperties. Set to 'SqlDedicatedGateway' for type SqlDedicatedGatewayServiceResourceProperties. Set to 'GraphAPICompute' for type GraphAPIComputeServiceResourceProperties. Set to 'MaterializedViewsBuilder' for type MaterializedViewsBuilderServiceResourceProperties. 'DataTransfer'
'GraphAPICompute'
'MaterializedViewsBuilder'
'SqlDedicatedGateway' (required)

SqlDedicatedGatewayServiceResourceProperties

Name Description Value
dedicatedGatewayType DedicatedGatewayType for the service. 'DistributedQuery'
'IntegratedCache'
instanceCount Instance count for the service. int

Constraints:
Min value = 0
instanceSize Instance type for the service. 'Cosmos.D16s'
'Cosmos.D4s'
'Cosmos.D8s'
serviceType ServiceType for the service. 'SqlDedicatedGateway' (required)
sqlDedicatedGatewayEndpoint SqlDedicatedGateway endpoint for the service. string