Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure a Cosmos Db collection during deployment

When deploying a Cosmos Db database in GlobalDocumentDB mode using the Azure resource manager template there is no way to configure collections in the database during deployment that I can tell.

During a ARM template deployment is there any way to either (in order of preference)

  1. Configure the collections in a Cosmos Db database directly in a way that I have overlooked.
  2. Do a series of REST requests from within the template to configure the db.
  3. Do a single REST request within the template to hit a Azure Function with a HttpTrigger that will configure the database.
like image 580
Scott Chamberlain Avatar asked Sep 14 '17 15:09

Scott Chamberlain


People also ask

Is it possible to use cosmos for geo redundant deployment?

When you enable geo-redundancy for an Azure Cosmos DB SQL API account, you can then use the SDK to read data from regions in any order you configure. This technique is beneficial when you distribute your read requests across all of your available read regions.

Is container and collection same in Cosmos DB?

In Cosmos DB Container is just like a collection of documents. Container is a single logical resource composed of multiple physical partitions. It is just like a Template and has Partition Key and Throughput.


1 Answers

You should be able to use these Templates.

  • Containers:
    https://docs.microsoft.com/en-us/azure/templates/microsoft.documentdb/2015-04-08/databaseaccounts/apis/databases/containers
  • Collections:
    https://docs.microsoft.com/en-us/azure/templates/microsoft.documentdb/2015-04-08/databaseaccounts/apis/databases/collections
  • All Microsoft.DocumentDB Resource Types:
    https://docs.microsoft.com/en-us/azure/templates/microsoft.documentdb/allversions

These pages were published on 05/01/2019 & are for API version 2015-04-08.

like image 92
JoeBrockhaus Avatar answered Mar 28 '23 20:03

JoeBrockhaus