Why won't powershell or command prompt recognize 'az' command?

Nikola Kuzmanovic 0 Reputation points
2023-05-02T06:07:50.17+00:00

I tried multiple times to use 'az' command in both PowerShell and Command Prompt, and it still does not recognize it as a command.

What am I not doing, or doing wrong?

Windows for business Windows Server User experience PowerShell
Microsoft Security Microsoft Entra Microsoft Entra ID
{count} votes

3 answers

Sort by: Most helpful
  1. Limitless Technology 44,751 Reputation points
    2023-05-02T15:16:23.1666667+00:00

    Hi,

    I'd be happy to help you out with your question. Sorry for the inconvenience caused.

    There are a couple of things that could be causing this problem. One possibility is that Azure CLI, which includes the 'az' command, is not installed on your system. You can download and install Azure CLI by following the instructions on the Azure CLI installation page (https://docs.microsoft.com/en-us/cli/azure/install-azure-cli).

    Another possibility is that the installation path for Azure CLI is not included in the PATH environment variable on your system. This can prevent PowerShell and Command Prompt from recognizing the 'az' command. To check if this is the case, open PowerShell or Command Prompt and type 'echo %PATH%'. Look for the installation path of Azure CLI in the output. If it's not there, you can add it manually by following these steps:

    1. Open the Start menu and search for "Environment Variables"
    2. Click "Edit the system environment variables"
    3. Click the "Environment Variables" button
    4. Under "System Variables", scroll down and find "Path"
    5. Click "Edit" and add the installation path of Azure CLI at the end of the list (e.g., C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin)

    Once you've added the installation path, be sure to restart PowerShell or Command Prompt for the changes to take effect.

    For more Information, please refer to following resource :-

    PowerShell Azure commands not recognized in PowerShell 7 - https://learn.microsoft.com/answers/questions/641178/powershell-azure-commands-not-recognized-in-powers

    If you have any other questions or need assistance with anything, please don't hesitate to let me know. I'm here to help.

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.

    1 person found this answer helpful.
    0 comments No comments

  2. Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
    2023-05-02T08:26:40.8733333+00:00

    Do you have the Azure CLI installed? https://learn.microsoft.com/en-us/cli/azure/install-azure-cli

    After you have installed it, you can start using the "az" command in either cmd or PowerShell.

    0 comments No comments

  3. Ivan Andrade 0 Reputation points
    2023-08-23T16:06:41.9833333+00:00

    Hello
    I had a similar situation and found out that my system had a broken azure-cli version on 2.50.0

    This was detected running the following command in a PowerShell terminal

    Get-WmiObject Win32_Product | Where Name -like 'Microsoft Azure CLI*'
    

    The above command should return you with an entry to the broken azure-cli with its identifying number. With this result, run the following command to attempt and remove the broken version

    msiexec /x "{YOUR_SOFTWARE_IDENTIFYING_NUMBER_HERE}"
    

    This will then bring up a GUI window and allow you to uninstall the software. Please note that both the double quotes and the curly brackets should be included as part of the command after /x.

    I hope this helps other developers.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.