Skip to content

Latest commit

 

History

History
86 lines (52 loc) · 4.17 KB

manage-with-bicep.md

File metadata and controls

86 lines (52 loc) · 4.17 KB
title description author ms.service ms.subservice ms.custom ms.topic ms.date ms.author ms.reviewer
Create and manage Azure Cosmos DB with Bicep
Use Bicep to create and configure Azure Cosmos DB for API for NoSQL
seesharprun
azure-cosmos-db
nosql
devx-track-bicep
how-to
02/18/2022
sidandrews
mjbrown

Manage Azure Cosmos DB for NoSQL resources with Bicep

[!INCLUDENoSQL]

In this article, you learn how to use Bicep to deploy and manage your Azure Cosmos DB accounts, databases, and containers.

This article shows Bicep samples for API for NoSQL accounts. You can also find Bicep samples for Cassandra, Gremlin, MongoDB, and Table APIs.

Important

  • Account names are limited to 44 characters, all lowercase.
  • To change the throughput (RU/s) values, redeploy the Bicep file with updated RU/s.
  • When you add or remove locations to an Azure Cosmos DB account, you can't simultaneously modify other properties. These operations must be done separately.
  • To provision throughput at the database level and share across all containers, apply the throughput values to the database options property.

To create any of the Azure Cosmos DB resources below, copy the following example into a new bicep file. You can optionally create a parameters file to use when deploying multiple instances of the same resource with different names and values. There are many ways to deploy Azure Bicep files including, Azure CLI, Azure PowerShell and Cloud Shell.

Azure Cosmos DB account with autoscale throughput

Create an Azure Cosmos DB account in two regions with options for consistency and failover, with database and container configured for autoscale throughput that has most index policy options enabled.

:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.documentdb/cosmosdb-sql-autoscale/main.bicep":::

Azure Cosmos DB account with analytical store

Create an Azure Cosmos DB account in one region with a container with Analytical TTL enabled and options for manual or autoscale throughput.

:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.documentdb/cosmosdb-sql-analytical-store/main.bicep":::

Azure Cosmos DB account with standard provisioned throughput

Create an Azure Cosmos DB account in two regions with options for consistency and failover, with database and container configured for standard throughput that has most policy options enabled.

:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.documentdb/cosmosdb-sql/main.bicep":::

Azure Cosmos DB container with server-side functionality

Create an Azure Cosmos DB account, database and container with a stored procedure, trigger, and user-defined function.

:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.documentdb/cosmosdb-sql-container-sprocs/main.bicep":::

Azure Cosmos DB account with Microsoft Entra ID and RBAC

Create an Azure Cosmos DB account, a natively maintained Role Definition, and a natively maintained Role Assignment for a Microsoft Entra identity.

:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.documentdb/cosmosdb-sql-rbac/main.bicep":::

Free tier Azure Cosmos DB account

Create a free-tier Azure Cosmos DB account and a database with shared throughput that can be shared with up to 25 containers.

:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.documentdb/cosmosdb-free/main.bicep":::

Next steps

Here are some additional resources: