During my last project I was setting up a Release Pipeline in VSTS and one of the steps was to create a Sharded MongoDB in Cosmos DB.
I am a big fan of the Azure CLI, which I use quiet often.
I started to create in bash an Azure CLI script but soon I discovered that it was not working well. The script gave no errors, everything seemed to be ok, but I was getting an error when inserting a document that the sharded key was not found/provided. Continue reading “Create a sharded MongoDB in Azure Cosmos DB”
I’m using more and more the Azure CLI 2.0, which makes my scripting life with Azure Resources a lot easier.
The default output of the Azure CLI is json, but you can also use other kind of output formats, as described in this blog.
I want to have some variables that I can reuse in other commands, so let’s say I want to get the name of all the Resource Groups which have a tag called Kind with a value VM, I can use the following JMESPath query:
az group list --query "[?tags.Kind=='VM'].name"
The output will be:
Continue reading “Create output variables with Azure CLI 2.0”