Install-Module AzureRM fails with PackageManagement\Install-Package: Package 'AzureRM.profile' failed to be installed because: A local file header is corrupt.
I am using a fresh Windows 10 build 1607 and I am getting the following error when trying to install the AzureRM module:
+1 - Receiving this issue as well.
Hi, @lambdakris please try the following steps:
- Install-Module AzureRM.Profile -RequiredVersion 1.0.11
- Install-Module AzureRM.Profile -RequiredVersion 2.0.0.0
- Install-Module Azure.Storage -RequiredVersion 1.1.5
- Install-Module Azure.Storage -RequiredVersion 2.0
- Install-Module AzureRM
@lambdakris Please do not follow this advice. This will download unnecessary versions of modules. We are pushing out a new module version, and delisting the 2.0 versions of each of the dependent modules to work around the bug mentioned below in the Gallery.
This problem happens because of the following reason:
- AzureRM has lots of dependencies. If you traverse the dependency chain, you will notice different versions of AzureRM.Profile in the dependency chain.
- PowerShellGet has a problem installing 2 versions of the same module in 1 Install-Module call
Thanks for reporting the issue. Please use the workaround that @quoctruong mentioned until we fix this issue.
@quoctruong thank you for that, I've just tried it however still receiving the following:
PackageManagement\Install-Package : Package 'AzureRM.profile' failed to be installed because: A local file header is corrupt. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1375 char:21
- ... $null = PackageManagement\Install-Package @PSBoundParameters
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : InvalidResult: (AzureRM.profile:String) [Install-Package], Exception
- FullyQualifiedErrorId : Package '{0}' failed to be installed because: {1},Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
PackageManagement\Install-Package : Collection was modified; enumeration operation may not execute. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1375 char:21
- ... $null = PackageManagement\Install-Package @PSBoundParameters
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
- FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
@ljt91 @quoctruong @KrishnaV-MSFT @lambdakris Just finished a thread with Krishna and Quoc, Krishna's assessment above is not correct. There are not multiple versions of a module in the dependency chain for the AzureRM module. They didn't notice that version 2.0 of Azure and AzureRM were delisted, so that the latest modules are not the ones referenced from AzureRM v 1.6.
According to Quoc, the Gallery is apparently not resolving the dependent module RequiredVersion constraint correctly - the RequiredVersion constraint from the AzureRM module is not being honored when resolving the dependencies for the dependent modules in its chain. I'm told the underlying issue will be fixed.
This should be resolved when the new version is pushed out (within the hour)
@lambdakris @ljt91 @anurse @KrishnaV-MSFT @quoctruong This is now resolved. The hotfix modules for 2.0 are out. Please verify, and apologies for the bad experience. We've adjusted our hotfix policies, and we'll work with the PSGet team to ensure this doesn't happen again when pulling back a module.
@markcowl I can confirm that it's resolved from my side. All installed and working. Thank you very much for getting the fix out so quickly.
closing for now
I am running into this issue. Please help!!!!
@rachelgshaffer would you mind running the following two commands and returning the results?
Get-Module -ListAvailableInstall-Module -Name AzureRM -Repository PSGallery
Closing as no repro
I tried to install AzSk with the following command : iwr 'https://aka.ms/azsk/install.ps1' -UseBasicParsing | iex
I am getting the following error :

I am also having this issue trying to install AzureRM 6.8.1 module. Something is wrong with AzureRM.Profile 5.5.1 version. Is someone going to fix this?