Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install Azure Module in PowerShell

When installing the Azure module:

PS> Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force

I get this error:

PackageManagement\Install-Package : Could not find a part of the path 'C:\Users\MB\Documents\WindowsPowerShell\Modules\Az.Accounts\1.7.1'. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21

  • ... $null = PackageManagement\Install-Package @PSBoundParameters
  •                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exce ption
    • FullyQualifiedErrorId : System.IO.DirectoryNotFoundException,Microsoft.PowerShell.Commands.CopyItemCommand,Micro soft.PowerShell.PackageManagement.Cmdlets.InstallPackage
like image 655
Mustafa Elimam Avatar asked Oct 25 '25 06:10

Mustafa Elimam


1 Answers

According to Microsoft, you can also install the MSI directly since their Powershell module installer is broken at the moment.

According to the documentation:
(https://learn.microsoft.com/en-us/powershell/azure/install-az-ps-msi)

Navigate to the Azure Github release page https://github.com/Azure/azure-powershell/releases
Scroll down until you find the latest Assets chevron that contains an Az-Cmdlets-x.x.x-x64.msi file.
Download and install the MSI.
Relaunch Powershell and you should be good to go.

like image 59
Brain2000 Avatar answered Oct 26 '25 21:10

Brain2000