MicrosoftDocs/azure-docs-cli

[Install] winget installation instructions don't add az to path

Closed this issue ยท 10 comments

Prerequisites

  • Write a descriptive title.
  • Search the existing issues.
  • I am reporting the documentation problem for the current version of Azure CLI.

Azure CLI version being used

n/a

Link to affected document

https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=powershell

Description of the documentation error

I followed the winget installation instructions:

winget install -e --id Microsoft.AzureCLI

But this did not add az to my path. I am unable to run the az command bare; I have to run it:

& "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd"

Suggested fix

2 possible fixes:

  1. Fix the winget recipe to include adding az to the path.
  2. Tell folks to add the directory to their path manually: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin

@citelao
Thanks for your feedback! We will investigate and update as appropriate.

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

Kindly restart terminal and it should work.

@citelao, Did you restart PowerShell before you tried to run az? That should fix the problem.

@citelao, We are closing this issue for now, but feel free to comment here as necessary. Thank you for your feedback.

Found this page during a websearch. A terminal restart is indeed the answer.

Took me a while to login to respond to this issue, but yes, restarting Terminal (not PowerShell!) was sufficient to add az to the path. Modern versions of Terminal will also find az on the path in new tabs (no Terminal restart necessary): microsoft/terminal#14999 and microsoft/terminal#15102.

This is caused by microsoft/winget-cli#549 (see also microsoft/winget-cli#549 (comment)).

I've installed the az yesterday via winget and restarting the windows powershell and even reboot the system does not help. The installation does not add it to the path. Probably @dbradish-microsoft can reopen the issue.

@thedomeffm, What version of Windows are you running? winget is only available by default in Windows 11 and modern versions of Windows 10.

@thedomeffm, What version of Windows are you running? winget is only available by default in Windows 11 and modern versions of Windows 10.

Windows 11 Enterprise 23H2

@dbradish-microsoft

I've solved it by adding the following path to the $profile.CurrentUserCurrentHost:

$env:Path += ';C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin'

But from my expecation the installation of azure cli should have done it!