The Azure CLI is an open source and cross-platform tool that supports implementing all the tasks you can do in the Azure portal with commands. This tool can be used to provide automation by writing all the tasks you want to configure in the Azure CLI and running it instead of manually doing it over and over again. It can be used to run on Windows, Linux, and macOS. The latest version is Azure CLI 2.0.
Azure CLI Installation
Perform the following steps to install Azure CLI 2.0.
- Download Azure CLI 2.0 from the following link: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli.
- Once downloaded, you can start the installation.
Once you click on Install, it will start to validate your environment to check whether it is compatible with it or not. Then, it starts the installation:
Once the installation completes, you can click on Finish, and you are good to go.
Once done, you can open Command Prompt and write az to access Azure the CLI commands.
Run the Azure CLI
You can now run the Azure CLI with the
az command from either Windows Command Prompt or PowerShell. PowerShell offers some tab completion features not available from Windows Command Prompt. To sign in, run the az login command.
- Run the
If the CLI can open your default browser, it will do so and load an Azure sign-in page. Otherwise, open a browser page at https://aka.ms/devicelogin and enter the authorization code displayed in your terminal.
If no web browser is available or the web browser fails to open, use device code flow with az login –use-device-code.
- Sign in with your account credentials in the browser.