Azure CLI Not Recognized in PowerShell? Here’s How to Fix It on Windows

If you run this command in PowerShell:

az --version

and get this error:

az : The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program.

don’t panic. This usually means one of two things: Azure CLI is not installed on your Windows machine, or it was installed but the current terminal session does not yet recognize it in the system PATH. Microsoft’s official documentation confirms that after installation you should close and reopen the terminal before trying the az command again.

What Is Azure CLI?

Azure CLI is Microsoft’s cross-platform command-line tool for managing Azure resources. It lets you create, configure, automate, and manage Azure services directly from the command line instead of clicking through the Azure portal. Microsoft provides Azure CLI for Windows, Linux, and macOS, and it is also available in Azure Cloud Shell.

For developers, administrators, and DevOps engineers, Azure CLI is one of the fastest ways to work with Azure subscriptions, resource groups, virtual machines, storage accounts, networking, and much more.

Why This Error Happens

When PowerShell says az is not recognized, the most common reasons are:

  • Azure CLI has not been installed yet
  • Azure CLI was installed, but PowerShell was not restarted
  • The installation did not update the system PATH correctly
  • You are using a restricted environment where a standard install is not available

According to Microsoft, the most common cause after installation is simply that the active terminal window was not restarted.

Best Way to Install Azure CLI on Windows

The cleanest method on modern Windows systems is to install Azure CLI using WinGet. Microsoft documents the following command for Windows installation:

winget install --exact --id Microsoft.AzureCLI

Run PowerShell as Administrator, execute the command above, and let the installation complete.

After that, close PowerShell completely, open a fresh terminal, and verify the installation:

az --version

If the installation succeeded, PowerShell should now return the Azure CLI version details.

Next Step: Sign In to Azure

Once Azure CLI is installed, the next step is authentication. Microsoft recommends signing in interactively with:

az login

This opens the browser-based login flow. If a browser does not open or you are working in a constrained environment, Microsoft also supports device code authentication using:

az login --use-device-code

After login, you can confirm the active subscription with:

az account show

These are part of Microsoft’s official getting-started flow for Azure CLI.

What If WinGet Is Not Available?

If winget is not installed or not working, Microsoft also provides other Windows installation methods.

Option 1: MSI Installer

Microsoft offers an official MSI installer for Windows. This is a good option if you prefer a traditional installation package or are working on a machine where package managers are restricted.

Option 2: ZIP Package

Microsoft also provides a ZIP package for Azure CLI on Windows. This is particularly useful when you do not have administrative privileges. In that case, you can unzip the package and run Azure CLI using:

<unzipped folder path>\bin\az.cmd

The ZIP-based method is documented by Microsoft as a preview install option for Windows.

How to Troubleshoot If It Still Fails

If you have already installed Azure CLI and az still doesn’t work, use these commands in PowerShell:

where.exe az
$env:Path -split ';'

What these checks tell you

  • where.exe az shows whether Windows can find the Azure CLI executable
  • $env:Path -split ';' displays your current PATH entries so you can confirm whether the Azure CLI install folder is included

Microsoft notes that on Windows, Azure CLI is typically installed under:

  • C:\Program Files\Microsoft SDKs\Azure\CLI2 for 64-bit
  • C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2 for 32-bit

So if where.exe az returns nothing, it often means one of these happened:

  • the install failed
  • PATH was not updated
  • you are still using the old terminal session
  • the installation location is present but not visible to the shell

A Simple Step-by-Step Fix

Here is the easiest recovery process for most Windows users:

1. Open PowerShell as Administrator

2. Install Azure CLI

winget install --exact --id Microsoft.AzureCLI

3. Close and reopen PowerShell

This matters. Microsoft explicitly recommends restarting the terminal after installation.

4. Verify the install

az --version

5. Sign in

az login

6. Confirm your subscription

az account show

An Alternative: Use Azure Cloud Shell

If you need Azure CLI immediately and do not want to install anything locally, Microsoft recommends Azure Cloud Shell as the easiest way to try Azure CLI. Cloud Shell runs in the browser and already includes the latest Azure CLI.

This can be a great fallback when:

  • you are on a locked-down corporate laptop
  • your local Windows setup is broken
  • you want to test commands quickly before installing tools locally

Final Thoughts

The az is not recognized error is common, but it is usually easy to fix. In most cases, the solution is simply to install Azure CLI properly, then restart PowerShell so the new PATH is loaded. If that still doesn’t work, check whether Windows can locate the executable with where.exe az.

For Windows environments, the WinGet installation method is usually the fastest and cleanest option. If that is not possible, the MSI installer or ZIP package are solid alternatives. And if local installation is not practical at all, Azure Cloud Shell gives you instant access to Azure CLI in the browser.

Useful Commands Summary

winget install --exact --id Microsoft.AzureCLI
az --version
az login
az login --use-device-code
az account show
where.exe az
$env:Path -split ';'