Microsoft Azure - Install Azure Command Line Interface (Azure CLI)
Last Updated :
22 Nov, 2023
Azure CLI is a very powerful tool that can be used to automate tasks, create, update, manage or delete azure resources or to troubleshoot problems with az module cmdlets. By installing az modules on your system or on your development system you and your development team can easily create, update or manage Azure AD and Azure resources such as management groups, subscriptions, resource groups, virtual machines, virtual networks, storage accounts, web apps or any other Azure native services directly from the command line interface.
If you are looking for a powerful and easy-to-use way to manage Azure resources, then you must definitely learn and make use of this Azure CLI command line tool to simplify the management across Azure services.
Requirements
- One should have administrator privileges on Windows System to install Azure CLI.
- The Azure CLI installer requires .NET Framework 4.7.2 or later.
Steps for Installing Azure CLI
Step 1: To install the Azure Command Line Interface (Azure CLI) we have to open Windows PowerShell from your system and select Run as Administrator. To Know the commands in Azure CLI to maintain the VMS refer to the Microsoft Azure – Azure CLI Commands to Manage Azure VMs.
.png)
Step 2: Now, we have to create a new PowerShell file to do that use the cmdlet New-Item <file name>.ps1
Syntax:
New-Item <file name>.ps1
Example:
New-Item installAzCLI.ps1

Step 3: Once you are done creating a new PowerShell file. Use the code cmdlet to add the script into the file. Check syntax and example.
Syntax:
Code .\<file name>.ps1
Example:
Code .\installAzCLI.ps1

Step 4: Now in the editor copy and paste the below following code to your PowerShell file <file name>.ps1 and use CTRL+S to save the changes.
$ProgressPreference = 'SilentlyContinue';
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi;
Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet';
rm .\AzureCLI.msi

Step 5: In step 4 we have saved the Azure CLI installation script. Now, to execute or run the PowerShell script use the following syntax structure .\<file name>.ps1
Syntax:
.\<file name>.ps1
Example:
.\installAzCLI.ps1

Wait until the installation is complete. (It might take 2-3 minutes to install az cli modules)

Verify Azure CLI Installation
Once the installation is complete, you can verify the installation was successful or not by by just typing the command az or az -h:
az
This az command will list the available Azure CLI commands.
az -h
This will also list the available Azure CLI commands. Check out the sample output for better understanding.
Sample Output:

If you wish to check the Azure CLI then you may check the version of Az CLI on your system by running this below command:
az version
This will list the versions of azure cli, azure cli core, azure cli telemetry and extensions version if any.
Sample Output:

To build your own CLI extension refer to Microsoft Azure – Building Your Own Azure CLI Extensions.
Clean Up or Uninstall Azure CLI from your Environment:
On your Desktop Click on Windows Start button > Go to Settings > select Apps >> select Apps & Features >> Search for Azure CLI >> Select Azure CLI service >> Click on Uninstall to continue the removal of Azure CLI.
Removal will take around 5-10 minutes. Wait until it's done and verify the removal of Azure CLI.

Verify Uninstallation of Azure CLI
Open Azure PowerShell or Command Prompt and type "az --version." If you are not getting any preview of Azure CLI, then you have successfully removed Azure CLI from your environment.
Sample Output before and after the removal of Azure CLI:

Similar Reads
How to Manage Azure CLI Extensions in Command Line Interface? In this article, we are going to provide the steps on how to list, find, install, update, and remove Azure CLI extensions from Azure Command Line Interface (Azure ACI) or Azure Cloud Shell. What are Azure CLI Extensions?Azure CLI or Command Line Interface is a powerful tool developed by Microsoft us
4 min read
How to Check the License Type of a Specific Azure VM using PowerShell Command? In this article, we will show you how to use the Get-AzVM command to check the license type of an Azure VM. We will also tell you about the different license types for Azure VMs. Azure virtual machines (VMs) can be licensed in different ways, like Azure Hybrid Benefit, pay-as-you-go, and Bring Your
3 min read
How To Deploy A Container To Azure Container Instances ? In layman's terms, how will it feel when a developer develops an app and a member of the testing team tries to test the application on his/her OS? They will have to install the packages, and libraries required to run the app. Well, in this case, the container makes it easy and faster to rapidly depl
8 min read
How to Install SQL Server on Azure VM? Microsoft Azure provides us with multiple database services which help us to run popular relational database management systems, like MySQL, SQL Server, and PostgreSQL in the cloud. We can use an SQL server on Azure Virtual machines by running a virtual machine in Azure and installing an SQL server
5 min read
How to Install Git on Windows Command Line? Git is an open-source and free, decentralized version control system designed to handle projects of all sizes with speed and efficiency. Basically, it is a software tracking application that is commonly used to monitor projects across several teams. The best way of downloading and installing Git on
3 min read