Get Started with Azure CLI 2.0 Commands

Get Started with Azure CLI 2.0 Commands

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! 

Sree Sabari Naroli

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?

回复

要查看或添加评论,请登录

Asaf Nakash的更多文章

  • I was named a finalist at Microsoft 2017 Partner of the year 2017 Award

    I was named a finalist at Microsoft 2017 Partner of the year 2017 Award

    On Thursday, June 01, Microsoft announced the annual partner of the year awards for 2017, and name me one of the…

    2 条评论
  • I am Now a Microsoft MVP

    I am Now a Microsoft MVP

    I am honored and proud to say that I have received the Microsoft Most Valuable Professional Award! Microsoft Most…

    6 条评论
  • Azure Manage Disks and Azure CLI 2.0

    Azure Manage Disks and Azure CLI 2.0

    A week ago Microsoft announced the new Manage disk offering which changes the game of Azure disk and storage. The…

    3 条评论
  • Install Azure CLI 2.0 on a MAC

    Install Azure CLI 2.0 on a MAC

    Azure CLI is the cross-platform Azure management tools. It runs on every platform - Windows, Linux, and Mac OS.

社区洞察

其他会员也浏览了