Install Azure CLI on Windows

The Azure Command-Line Interface (CLI) is a cross-platform command-line tool that can be installed locally on Windows computers. You can use the Azure CLI for Windows to connect to Azure and execute administrative commands on Azure resources. The Azure CLI for Windows can also be used from a browser through the Azure Cloud Shell or run from inside a Docker container.

For Windows, the Azure CLI is installed via a MSI, which gives you access to the CLI through the Windows Command Prompt (CMD) or PowerShell. When installing for Windows Subsystem for Linux (WSL), packages are available for your Linux distribution. See the main install page for the list of supported package managers or how to install manually under WSL.

The current version of the Azure CLI is 2.49.0. For information about the latest release, see the release notes. To find your installed version and see if you need to update, run az version.

Install or update

The MSI distributable is used for installing or updating the Azure CLI on Windows. You don't need to uninstall current versions before using the MSI installer because the MSI will update any existing version.

Note

After the installation is complete, you will need to close and reopen any active terminal window to use the Azure CLI.

Latest version

Download and install the latest release of the Azure CLI. When the installer asks if it can make changes to your computer, click the "Yes" box.

Specific version

To download the MSI installer for specific version, change the version segment in URL https://azcliprod.blob.core.windows.net/msi/azure-cli-<version>.msi and download it. Available versions can be found at Azure CLI release notes.

Run the Azure CLI

You can now run the Azure CLI with the az command from either Windows Command Prompt or PowerShell.

Enable Tab Completion on PowerShell

PowerShell provides completion on inputs to provide hints, enable discovery and speed up input entry. Command names, command group names, parameters and certain parameter values can be completed by pressing the Tab key.

Note

Azure CLI version 2.49 or higher is required to enable tab completion for Azure CLI on PowerShell.

To enable tab completion in PowerShell, create or edit the profile stored in the variable $PROFILE. The simplest way is to run notepad $PROFILE in PowerShell. For more information, see How to create your profile and Profiles and execution policy.

Then add the following code to your PowerShell profile:

Register-ArgumentCompleter -Native -CommandName az -ScriptBlock {
    param($commandName, $wordToComplete, $cursorPosition)
    $completion_file = New-TemporaryFile
    $env:ARGCOMPLETE_USE_TEMPFILES = 1
    $env:_ARGCOMPLETE_STDOUT_FILENAME = $completion_file
    $env:COMP_LINE = $wordToComplete
    $env:COMP_POINT = $cursorPosition
    $env:_ARGCOMPLETE = 1
    $env:_ARGCOMPLETE_SUPPRESS_SPACE = 0
    $env:_ARGCOMPLETE_IFS = "`n"
    az 2>&1 | Out-Null
    Get-Content $completion_file | Sort-Object | ForEach-Object {
        [System.Management.Automation.CompletionResult]::new($_, $_, "ParameterValue", $_)
    }
    Remove-Item $completion_file, Env:\_ARGCOMPLETE_STDOUT_FILENAME, Env:\ARGCOMPLETE_USE_TEMPFILES, Env:\COMP_LINE, Env:\COMP_POINT, Env:\_ARGCOMPLETE, Env:\_ARGCOMPLETE_SUPPRESS_SPACE, Env:\_ARGCOMPLETE_IFS
}

To display all available options in the menu, add Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete to your PowerShell profile.

Troubleshooting

Here are some common problems seen when installing the Azure CLI on Windows. If you experience a problem not covered here, file an issue on GitHub.

Proxy blocks connection

If you can't download the MSI installer because your proxy is blocking the connection, make sure that you have your proxy properly configured. For Windows 10, these settings are managed in the Settings > Network & Internet > Proxy pane. Contact your system administrator for the required settings, or for situations where your machine may be configuration-managed or require advanced setup.

Important

These settings are also required to be able to access Azure services with the CLI, from both PowerShell or the Command Prompt. In PowerShell, you do this with the following command:

(New-Object System.Net.WebClient).Proxy.Credentials = `
  [System.Net.CredentialCache]::DefaultNetworkCredentials

In order to get the MSI, your proxy needs to allow HTTPS connections to the following addresses:

  • https://aka.ms/
  • https://azcliprod.blob.core.windows.net/

Uninstall

If you decide to uninstall the Azure CLI, we're sorry to see you go. Before you uninstall, use the az feedback command to let us know what could be improved or fixed. Our goal is to make the Azure CLI bug-free and user-friendly. If you found a bug, we'd appreciate it if you file a GitHub issue.

You uninstall the Azure CLI from the Windows "Apps and Features" list. To uninstall:

Platform Instructions
Windows 11 Start > Settings > Apps > Installed apps
Windows 10 Start > Settings > System > Apps & Features
Windows 8 and Windows 7 Start > Control Panel > Programs > Uninstall a program

Once on this screen type Azure CLI into the program search bar. The program to uninstall is listed as Microsoft CLI 2.0 for Azure. Select this application, then click the Uninstall button.

Remove data

If you don't plan to reinstall Azure CLI, remove its data from C:\Users\<username>\.azure\msal_token_cache.bin or C:\Users\<username>\.azure\msal_token_cache.json.

Next Steps

Now that you've installed the Azure CLI on Windows, take a short tour of its features and common commands.