Get Started with Azure CLI 2.0 Commands
Asaf Nakash
Product Manager - AI Security | Helping customers protect their custom built AI applications @ Microsoft
Azure CLI 2.0 is the new cross-platform Command Line Interface tool to manage your azure deployment, to install Azure CLI please refer to this article.
login:
1. login to Azure: type: az login
2. browse to https://aka.ms/devicelogin and enter the code provided in the previous command
3. login with your Microsoft / work account
4. wait for the login command to finish (can take some time, depend on the number of subscription your account have permission)
5.you will get a JSON reply with all of the subscriptions you are logged in.
Start using CLI Commands:
1. Azure CLI Syntax: az [Sub Group] [Command] --options
2. list subscriptions: az account list
3. Select subscription: az account set --subscription <ID/Name>
4. get all virtual machines: az vm list
Using `--help` command
you can use --help to get help at every level
for example, if we want to stop a virtual machine and don't know the command syntax:
1.first we run the "az --help" to return the command groups for the highest level of CLI
2. we can see that there is a "VM" subset, now we can search help for this subgroup - az vm --help will return:
3. look like az vm stop command is the right one, now let's check for this command parameters "az vm stop --help"
4. now we have the full command: az vm stop -n nakashvm -g nakash-rg
I hope that this short article encourages you to start using the Azure CLI and to see that it is very easy to understand it's syntax.
Take Care and happy coding!
Intermediate Developer | Java/J2EE | SpringBoot | Spring MVC | Spring core | Microservices | REST API | MS SQL | GKE | Test Automation | GCP | Azure | Bigtable | Bigquery
6 年Hi Asaf, I need one help, How to hide JSON reply with all of the subscriptions when we use 'az login'. I didn't want to display the credentials info in log?