Install & Configure Azure CLI

This short tutorial covers topics like install Azure CLI, log in so you can use command via terminal and select account/subscription.

First, install Azure CLI:

brew update && brew install azure-cli

Then, log in to your Azure account by executing the following command:

az login

This command will open a browser window where you can sign to Azure. If the login was successful you will see a list of your current subscriptions.

[
{
"cloudName": "AzureCloud",
"id": "subscripion1-id",
"isDefault": true,
"name": "Pay-As-You-Go",
"state": "Enabled",
"tenantId": "tenant-id",
"user": {
"name": "your-account-id-or-email",
"type": "user"
}
},
{
"cloudName": "AzureCloud",
"id": "subscription2-id",
"isDefault": false,
"name": "Pay-As-You-Go",
"state": "Enabled",
"tenantId": "tenant-id",
"user": {
"name": "your-account-id-or-email",
"type": "user"
}
}
]

I have 2 subscriptions so for me it’s 2 items. You can output this data any time by typing az account list or az account list — output table for table output.

Now, it is important that you select correct subscription so you can see related resources in this subscription. To do so, execute:

az account set --subscription <enter-your-subscription-id>

To check if it works or not you can list your current resources in the selected subscription:

az resource list# oraz resource list --output table

Finally, if you want to see details of the subscription you can use the following command:

az account show -s <enter-subscription-id-or-name>

Software Engineer. https://kenanbek.github.io/ for code snippets and periodic posts. Follow Twitter for updates.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store