Jon Cluff
Jon Cluff

Reputation: 109

upload CosmosDB indexing policy with Powershell

Is it possible Via Powershell to upload a Json Document to Replace the Current Indexing Policy on a CosmosDB Database, if so How? we would like to be able to deploy a completed File rather than edit the file via the portal, we can then implement versioning, then no one is hand editing files, or cutting and pasting.

Upvotes: 0

Views: 648

Answers (1)

Nick Chapsas
Nick Chapsas

Reputation: 7190

You can use the Azure CLI (which can run through powershell) in order to run the az cosmosdb collection update command which can be found here here.

You will need to use the --indexing-policy optional parameter to achieve this.

You can enter it as a string or as a file, e.g., --indexing-policy @policy-file.json)

For the record if you use the --url-connection and --key arguments you won't need to az login.

Upvotes: 1

Related Questions