Start: Getting started with CLI
az interactive
seems to be interesting one
(I struggled to find autocompletion for bash, did not spend much time on it).
Refer also to: lab1-7-azure_cli.md
az login
az account show
[
{
"cloudName": "AzureCloud",
"homeTenantId": "a8....d64",
"id": "98612...329",
"isDefault": true,
"managedByTenants": [],
"name": "Free Subscription",
"state": "Enabled",
"tenantId": "a8e...d64",
"user": {
"name": "myemail@gmail.com",
"type": "user"
}
}
]
az group list --query "[?location=='westus']"
[
{
"id": "/subscriptions/9861...29/resourceGroups/may26th",
"location": "westus",
"managedBy": null,
"name": "may26th",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null,
"type": "Microsoft.Resources/resourceGroups"
}
]
az cosmosdb account list
List of cosmosdb accounts:
ACCOUNTS=$(az cosmosdb list | jq .[].name -r)
If only one account - this will work; otherwise for-loop the query…
Lists database:
az cosmosdb database list --resource-group may26th --name ACCOUNTS
**Getting keys: **
az cosmosdb keys list –name thecosmos –resource-group may26th
{
"primaryMasterKey": "VpK...KQ==",
"primaryReadonlyMasterKey": "eP3jx...MtEA==",
"secondaryMasterKey": "NqM31...uODg==",
"secondaryReadonlyMasterKey": "J1RdS...OemYg=="
}