The Azure CLI is a command-line interface for managing and automate resources in Microsoft Azure. It allows automation of tasks such as creating virtual machines, deploying applications and more using the commands provided by the user.
The “install azure cli” is a command-line tool that allows users to manage their Azure account. It is available on Windows, Linux, macOS and the Azure Shell.
The Microsoft Azure CLI (Command Line Interface) is a collection of commands for creating and managing Azure cloud resources from Microsoft. This suite of tools was created with the goal of getting you up and running fast by allowing you to create resources from the command line, with an emphasis on automation.
This CLI is accessible on a variety of platforms, including macOS, Linux, and Docker containers, according to Microsoft. This post will walk you through the process of installing the CLI on each platform, as well as how to get started using Azure Cloud Shell.
Getting Started with the Azure CLI is a related article.
This page will serve as a guide. You’ll need an Azure Cloud account if you want to follow along step-by-step. This training may be completed with a free account.
The prerequisites for each operating system are listed, as well as the version used in the lesson.
Using Azure Cloud Shell to run Azure CLI
The Azure Cloud Shell is your buddy if you want to use the Azure CLI right away without having to install anything. The Azure CLI does not need installation and is very portable when used with Azure Cloud Shell. After all, all you need is a web browser to get started.
You must setup your environment, including the storage account Cloud Shell will utilize, in order to use the Azure CLI inside Azure Cloud Shell. Let’s get started right now.
- Navigate to the Azure Cloud Shell using a web browser on any operating system.
2. Then, as shown below, select Create Storage to create the storage account. This step tells Azure to create a storage account with all of the default options.
Creating a storage account in Cloud Shell
3. After Azure has established the storage account, you’ll be sent to an interactive Bash shell like the one below. Run az —version to verify that the Azure CLI is operational and to see what version is installed.
In the Cloud Shell, you may use the Azure CLI.
On Windows, you may install Azure CLI.
Let’s start with the most common operating system, Windows, to begin our whirlwind tour of Azure CLI on all operating systems. The guide uses Windows PowerShell v5.1 to set up the Azure CLI on Windows 10 Build 19042.
The Azure CLI may be installed on Windows using one of three methods: a conventional Windows MSI installer, PowerShell, or both. Let’s take a closer look at each technique.
Run az upgrade if you already have Azure CLI v2.2 or above installed and need to upgrade. Microsoft added this useful function to Azure CLI in version 2.11, and it will update Azure CLI with a single command. This saves time, although at the time of writing, the functionality is still under preview.
MSI Installer is used to install the Azure CLI.
If you don’t feel comfortable using PowerShell, you may always use an MSI to install the Azure CLI. To do so, follow these steps:
- Download the Azure CLI MSI and save it to your preferred place. This procedure will save the MSI to the Downloads folder.
2. Then, accept all of the settings in the MSI installation procedure. In any case, you won’t be able to modify the installation’s behavior.
3. Once you’ve installed the Azure CLI, double-check that it’s up and running. To do so, run Windows PowerShell and use the —version argument to verify the version.
If everything is set up properly, you should see something like this. You’ll see the azure-cli version as well as the Python version it uses.
Because the Azure CLI was created in Python, it requires Python.
The output of running az —version
The Azure CLI is installed by default in the C:Program Files (x86)Microsoft SDKsAzureCLI2wbin folder for v2. If Windows says the executable can’t be found when you enter az, it’s possible that the Azure CLI installation folder isn’t in your PATH. Run $env:PATH -split ‘;’ to find directories in your PATH.
Using PowerShell with MSI Installer to install
You may also use PowerShell to install the Azure CLI on Windows if you prefer the command line or need to automate the process.
To use PowerShell to install the Azure CLI, follow these steps:
- As an administrator, run Windows PowerShell.
How to Run PowerShell as an Administrator is a related topic.
2. In the PowerShell console, copy and paste the following commands. This command downloads the Azure MSI installer from the site supplied above, executes it while concealing all output, and then removes it.
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile.AzureCLI.msi ## Download the MSI ## Run the MSI installation with all output turned off. ##Remove the MSI installation Remove-Item -Path.AzureCLI.msi ##Start-Process msiexec.exe -Wait -ArgumentList ‘/I AzureCLI.msi /quiet’
3. Verify that the az command is in the PATH as mentioned in the MSI installer section after installation. —version az
Using Chocolatey to install the Azure CLI
Chocolatey, a prominent Windows software package manager, includes an Package for Azure CLI for the last Windows installation method. Chocolatey is a suitable option for deploying the Azure CLI on a large number of PCs at once or as part of a bigger automation script.
Related:How to Quickly Install Chocolatey and Get Started
The Azure CLI is updated on a regular basis by Microsoft. To update the Azure CLI that you already have installed using Chocolatey, execute choco upgrade azure-cli -y.
Assuming you already have Chocolatey installed:
- As an administrator, open a Windows PowerShell console.
2. Use a single line to install the Azure CLI.
Using Chocolatey to install the Azure CLI
Close and reopen the PowerShell console to confirm that your PATH has been updated.
4. Confirm that you can execute the az executable and use the —version flag to check the version.
Check the C:ProgramDatachocolateylogschocolatey.log for troubleshooting information if you have any issues with the installation.
On macOS, you may install the Azure CLI.
The Azure CLI may be installed on macOS using Homebrew. On macOS Catalina, this guide will use Homebrew v3.0.7. For macOS and Linux, Homebrew is a useful package management system.
To install Azure CLI on macOS, follow these steps:
- To begin, open the Apple Terminal.
2. To install it, use the command supplied by Homebrew.
“$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)” /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”
3. Update the Homebrew package repository to guarantee that when you perform the installation command, you get the most recent version of the Azure CLI. brew update
4. Finally, use the brew command to have the Azure CLI downloaded and installed.
If brew install returns an error about not being able to find Python, you must install Python yourself. To do that, run brew update && brew install python3 && brew upgrade python3 && brew link –overwrite python3. This series of commands will download the Python3 package, ensure it’s the latest version overwriting any previous Python package installed.
On Linux, you may install the Azure CLI.
The command line is used to set up the Azure CLI on Linux, as you would anticipate. The Azure CLI is available for a variety of Linux systems. The Azure CLI will be installed on both Ubuntu and CentOS in this tutorial.
The apt-get package manager is one of the most frequent methods to install the Azure CLI on Ubuntu.
Open a Terminal and type curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash if you don’t want to comprehend each step. This one-line operation will download a script from Microsoft and run it through all of the steps.
To use the apt-get package manager to install the Azure CLI, follow these steps:
- Open the Ubuntu Terminal application.
2. Update the apt-get repository cache to guarantee that all packages are up to date.
apt-get package cache is being refreshed.
3. Finally, use apt-get to install the required dependencies:
curl apt-transport-https lsb-release gnupg sudo apt-get install ca-certificates
output displaying the installed packages
4. Download and setup the Microsoft signing key using the curl command-line program. This key verifies that the Package for Azure CLI you downloaded originates from Microsoft.
downloads the signing key from Microsoft curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg –dearmor | ## unpacks the key sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null ## creates a file called microsoft.gpg in the folder where keys are stored
5. You’re almost there! The Azure CLI repository should then be added.
$(lsb release -cs)AZ REPO=$(lsb release -cs)AZ REPO=$(lsb release – ## returns the linux distribution’s codename, e.g. Ubuntu 18.04 = bionic echo “[arch=amd64] deb $AZ REPO main https://packages.microsoft.com/repos/azure-cli/ “| ## returns the complete URL, including the codename. /etc/apt/sources.list.d/azure-cli.list sudo tee ## adds the URL to the resource list of the package
6. Finally, get the Package for Azure CLI and install it.
To incorporate the newest repository updated in step 5, run apt-get update again.
apt-get update sudo azure-cli sudo apt-get install
Package for Azure CLI
CentOS or Fedora installation
You may install the Azure CLI on CentOS or Fedora as well. To do so, use the dnf package manager to download a package and follow a few more simple procedures.
On your CentOSFedora system, perform the following:
- Open a terminal window on CentOS or Fedora.
2. Next, create an entry for the Package for Azure CLI in the local Yum repository.
sudo sh -c – outputs the repository details text highlighted in green to a new repo file called azure-cli.repo. This file is written to a folder that holds all repositories. – baseurl is the location of the packages available. – gpgcheck will check authenticity of the packages – gpgkey is the location of the key to be used sudo sh -c ‘echo -e “[azure-cli] name=Azure CLI baseurl=https://packages.microsoft.com/yumrepos/azure-cli enabled=1 gpgcheck=1 gpgkey=https://packages.microsoft.com/keys/microsoft.asc” > /etc/yum.repos.d/azure-cli.repo’
3. Finally, invoke dnf to download and install the Package for Azure CLI.
azure-cli sudo dnf install
In a Container, Running the Azure CLI
You can utilize the Azure CLI in a Docker container if you’re in an isolated environment where you can’t (or don’t want to) alter anything on a system. You’ll learn how to install and execute the Azure CLI in Docker Desktop for Windows in this section.
Using Docker to Deploy Your First Container on Windows
Downloading the Microsoft-provided Docker image is one of the simplest methods to run the Azure CLI in a container. Let’s get started right now.
Assuming you’re using Windows and Docker Desktop is installed, follow these steps:
- Open a PowerShell command prompt.
2. Use the docker run command to construct a new container using a Microsoft-provided Docker image from the Microsoft Container Registry.
The command below downloads an image (mcr.microsoft.com/azure-cli) and then interactively opens a shell to the container after it’s completed (it).
mcr.microsoft.com/azure-cli docker run -it
The Azure CLI Docker image is being downloaded.
3. Open Docker for Desktop once Docker has started the container. Docker should now have launched a new container, which is ready to use. As indicated below, click RUN.
Docker for Desktop is used to run a Docker container.
4. Once the container image has started, click the CLI button to open a shell to the container running Azure CLI, as shown below. The container will be opened in an interactive shell when you press this button.
The image has been loaded and is running.
Once you’re in the shell, you’ll have access to all of the Azure CLI’s features.
az —version’s output
Run docker pull mcr.microsoft.com/azure-cli to update the Azure CLI Docker container.
It’s time to start utilizing the Azure CLI now that it’s all set up and ready to go! In the Getting Started with the Azure CLI lesson, you’ll learn how to connect to Azure and some fundamental commands like az login and az vm.
The “azure cli commands list” is a command-line tool that allows users to search and download app packages from the iOS App Store. The “azure cli commands list” is installed by default on Windows, Linux, and macOS operating systems.
- azure cli commands
- unable to locate package azure-cli
- azure cli version
- azure cli linux
- check azure cli version