Azure usefull commands series : 1

Below are some of the useful azure command that I use. I will not explain them fully just will mention briefly about their output.

Login:

First of all you need to connect to azure and to do that you need to run the command az login. When you run the command you will be prompted with this message

Az login

azlogin

You will need to open the browser to authenticate your self. Once you do that the output on the PowerShell will change which will show the list of all the subscriptions you are allowed to see.

List subscriptions

Lets list all the subscriptions again. Run the following command to do that.

Az account list

You will see the list of all the subscriptions you are allowed to see

 

Show active subscription

Now you need to verify that which subscription are you on. If you have only one subscription then you don’t have to worry about that. But if you have a dev and production subscription that its always good to make sure what is your active subscription. The following command will show the active subscription. This command show the default subscription.

Az account show

 

Change the subscription

All the command that you run are against the active subscription. If you have more than one subscription the following command can be used to switch.

Az account set  -s subscription_id

These are the basic command that are used to connect to azure and get your self started after that pretty much everything that you do on the portal can be automated and written in command in power shell.