Microsoft.DocumentDB databaseAccounts 2020-04-01

Template format

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

{
  "name": "string",
  "type": "Microsoft.DocumentDB/databaseAccounts",
  "apiVersion": "2020-04-01",
  "location": "string",
  "tags": {},
  "kind": "string",
  "properties": {
    "consistencyPolicy": {
      "defaultConsistencyLevel": "string",
      "maxStalenessPrefix": "integer",
      "maxIntervalInSeconds": "integer"
    },
    "locations": [
      {
        "locationName": "string",
        "failoverPriority": "integer",
        "isZoneRedundant": "boolean"
      }
    ],
    "databaseAccountOfferType": "Standard",
    "ipRules": [
      {
        "ipAddressOrRange": "string"
      }
    ],
    "isVirtualNetworkFilterEnabled": "boolean",
    "enableAutomaticFailover": "boolean",
    "capabilities": [
      {
        "name": "string"
      }
    ],
    "virtualNetworkRules": [
      {
        "id": "string",
        "ignoreMissingVNetServiceEndpoint": "boolean"
      }
    ],
    "enableMultipleWriteLocations": "boolean",
    "enableCassandraConnector": "boolean",
    "connectorOffer": "Small",
    "disableKeyBasedMetadataWriteAccess": "boolean",
    "keyVaultKeyUri": "string",
    "publicNetworkAccess": "string",
    "enableFreeTier": "boolean",
    "apiProperties": {
      "serverVersion": "string"
    },
    "enableAnalyticalStorage": "boolean",
    "cors": [
      {
        "allowedOrigins": "string",
        "allowedMethods": "string",
        "allowedHeaders": "string",
        "exposedHeaders": "string",
        "maxAgeInSeconds": "integer"
      }
    ]
  },
  "resources": []
}

Property values

The following tables describe the values you need to set in the schema.

Microsoft.DocumentDB/databaseAccounts object

Name Type Required Value
name string Yes Cosmos DB database account name.
type enum Yes Microsoft.DocumentDB/databaseAccounts
apiVersion enum Yes 2020-04-01
location string No The location of the resource group to which the resource belongs.
tags object No Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a template type is set with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB".
kind enum No Indicates the type of database account. This can only be set at database account creation. - GlobalDocumentDB, MongoDB, Parse
properties object Yes DatabaseAccountCreateUpdateProperties object
resources array No gremlinDatabases cassandraKeyspaces tables mongodbDatabases sqlDatabases

DatabaseAccountCreateUpdateProperties object

Name Type Required Value
consistencyPolicy object No The consistency policy for the Cosmos DB account. - ConsistencyPolicy object
locations array Yes An array that contains the georeplication locations enabled for the Cosmos DB account. - Location object
databaseAccountOfferType enum Yes The offer type for the database - Standard
ipRules array No List of IpRules. - IpAddressOrRange object
isVirtualNetworkFilterEnabled boolean No Flag to indicate whether to enable/disable Virtual Network ACL rules.
enableAutomaticFailover boolean No Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account.
capabilities array No List of Cosmos DB capabilities for the account - Capability object
virtualNetworkRules array No List of Virtual Network ACL rules configured for the Cosmos DB account. - VirtualNetworkRule object
enableMultipleWriteLocations boolean No Enables the account to write in multiple locations
enableCassandraConnector boolean No Enables the cassandra connector on the Cosmos DB C* account
connectorOffer enum No The cassandra connector offer type for the Cosmos DB database C* account. - Small
disableKeyBasedMetadataWriteAccess boolean No Disable write operations on metadata resources (databases, containers, throughput) via account keys
keyVaultKeyUri string No The URI of the key vault
publicNetworkAccess enum No Whether requests from Public Network are allowed. - Enabled or Disabled
enableFreeTier boolean No Flag to indicate whether Free Tier is enabled.
apiProperties object No API specific properties. Currently, supported only for MongoDB API. - ApiProperties object
enableAnalyticalStorage boolean No Flag to indicate whether to enable storage analytics.
cors array No The CORS policy for the Cosmos DB database account. - CorsPolicy object

ConsistencyPolicy object

Name Type Required Value
defaultConsistencyLevel enum Yes The default consistency level and configuration settings of the Cosmos DB account. - Eventual, Session, BoundedStaleness, Strong, ConsistentPrefix
maxStalenessPrefix integer No When used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'.
maxIntervalInSeconds integer No When used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'.

Location object

Name Type Required Value
locationName string No The name of the region.
failoverPriority integer No The failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.
isZoneRedundant boolean No Flag to indicate whether or not this region is an AvailabilityZone region

IpAddressOrRange object

Name Type Required Value
ipAddressOrRange string No A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”.

Capability object

Name Type Required Value
name string No Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin".

VirtualNetworkRule object

Name Type Required Value
id string No Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}.
ignoreMissingVNetServiceEndpoint boolean No Create firewall rule before the virtual network has vnet service endpoint enabled.

ApiProperties object

Name Type Required Value
serverVersion enum No Describes the ServerVersion of an a MongoDB account. - 3.2 or 3.6

CorsPolicy object

Name Type Required Value
allowedOrigins string Yes The origin domains that are permitted to make a request against the service via CORS.
allowedMethods string No The methods (HTTP request verbs) that the origin domain may use for a CORS request.
allowedHeaders string No The request headers that the origin domain may specify on the CORS request.
exposedHeaders string No The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer.
maxAgeInSeconds integer No The maximum amount time that a browser should cache the preflight OPTIONS request.

Quickstart templates

The following quickstart templates deploy this resource type.

Template Description
Create an Azure Cosmos DB account for Cassandra API

Deploy to Azure
This template creates an Azure Cosmos DB account for Cassandra API in two regions with a keyspace and table with dedicated throughput.
Create autoscale Azure Cosmos DB account for Cassandra API

Deploy to Azure
This template creates an Azure Cosmos DB account for Cassandra API in two regions with a keyspace and table with autoscale throughput.
Create an Azure CosmosDB Account

Deploy to Azure
This ARM template is intented to create a CosmosDB Account quickly with the minimal required values
Create an Azure Cosmos DB account in multiple regions

Deploy to Azure
This template creates an Azure Cosmos DB account for any API Type with a primary and secondary region with choice of consistency level and options to enable multi-master and Failover Type.
Create a free-tier Azure Cosmos DB account

Deploy to Azure
This template creates a free-tier Azure Cosmos account for Core (SQL) API with a database with shared throughput of 400 RU/s.
Create an Azure Cosmos DB account for Gremlin API

Deploy to Azure
This template creates an Azure Cosmos DB account for Gremlin API in two regions with one database and one graph using dedicated throughput.
Create an Azure Cosmos DB account for Gremlin API autoscale

Deploy to Azure
This template creates an Azure Cosmos DB account for Gremlin API in two regions with one database and one graph using autoscale throughput.
Create an Azure Cosmos account for MongoDB API (3.2 or 3.6)

Deploy to Azure
This template creates an Azure Cosmos DB account for MongoDB API (3.2 or 3.6) in two regions using shared database throughput with two collections.
Create an Azure Cosmos account for MongoDB API autoscale

Deploy to Azure
This template creates an Azure Cosmos DB account for MongoDB API (3.2 or 3.6) in two regions using shared autoscale database throughput with two collections.
Create an Azure Cosmos DB Account with a private endpoint

Deploy to Azure
This template will create a Cosmos account, a virtual network and a private endpoint exposing the Cosmos account to the virtual network.
Create an Azure Cosmos account for Core (SQL) API

Deploy to Azure
This template creates an Azure Cosmos account for Core (SQL) API with a database and container with throughput with multiple other options.
Azure Cosmos DB account SQL API with analytical store

Deploy to Azure
This template creates an Azure Cosmos account for Core (SQL) API with a database and container configured with autoscale and analytical store.
Create an Azure Cosmos DB account SQL API with autoscale

Deploy to Azure
This template creates an Azure Cosmos account for Core (SQL) API with a database and container with autoscale throughput with multiple other options.
Create Azure Cosmos Core (SQL) API stored procedures

Deploy to Azure
This template creates an Azure Cosmos account for Core (SQL) API and a container with a stored procedure, trigger and user defined function.
Create an Azure Cosmos account for Table API

Deploy to Azure
This template creates an Azure Cosmos DB account for Table API in two regions and a single table with provisioned throughput.
Create an Azure Cosmos account for Table API with autoscale

Deploy to Azure
This template creates an Azure Cosmos DB account for Table API in two regions and a single table with autoscale throughput.
Create a zero touch Azure Cosmos account and Azure Web App

Deploy to Azure
This template creates an Azure Cosmos account, injects the Cosmos DB endpoint and keys into Azure Web App settings, then deploys an ASP MVC web app from GitHub.
Create a CosmosDB Account with Advanced Threat Protection.

Deploy to Azure
This template allows you to deploy an Azure CosmosDB account with Advanced Threat Protection (preview) enabled.
Azure Cosmos DB Account with Web App

Deploy to Azure
This template deploys an Azure Cosmos DB account, an App Service Plan, and creates a Web App in the App Service Plan. It also adds two Application settings to the Web App that reference the Azure Cosmos DB account endpoint. This way solutions deployed to the Web App can connect to the Azure Cosmos DB account endpoint using those settings.
Web App with a SQL Database, Azure Cosmos DB, Azure Search

Deploy to Azure
This template provisions a Web App, a SQL Database, Azure Cosmos DB, Azure Search and Application Insights.
CI/CD using Jenkins on Azure Container Service (AKS)

Deploy to Azure
Containers make it very easy for you to continuously build and deploy your applications. By orchestrating deployment of those containers using Kubernetes in Azure Container Service, you can achieve replicable, manageable clusters of containers. By setting up a continuous build to produce your container images and orchestration, you can increase the speed and reliability of your deployment.