Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows 2022 image: Install-PowershellAzModules.ps1 script is failing in windows #11386

Open
2 of 16 tasks
antika080 opened this issue Jan 14, 2025 · 12 comments
Open
2 of 16 tasks

Comments

@antika080
Copy link

Description

windows 2022 image: : Install-PowershellAzModules.ps1 script is failing with below error:

Provisioning with powershell script: /agent/_work/21/s/runner-images/images/windows/templates/../scripts/build/Install-PowershellAzModules.ps1
Creating C:\Modules folder to store PowerShell Azure modules...
Installing azurerm to the C:\Modules path...

  • 2.1.0 [C:\Modules\azurerm_2.1.0]
    WARNING: Package 'AzureRM' failed to be installed because: End of Central Directory record could not be found.
    WARNING: Package 'AzureRM' failed to install.
    PackageManagement\Save-Package : Unable to save the module 'AzureRM'.
    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:11794 char:21
  •         $null = PackageManagement\Save-Package @PSBoundParameters
    
  •                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (Microsoft.Power...ets.SavePackage:SavePackage) [Save-Package], Except
      ion
    • FullyQualifiedErrorId : ProviderFailToDownloadFile,Microsoft.PowerShell.PackageManagement.Cmdlets.SavePackage

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • Ubuntu 24.04
  • macOS 12
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • macOS 15
  • macOS 15 Arm64
  • Windows Server 2019
  • Windows Server 2022
  • Windows Server 2025

Image version and build link

NA

Is it regression?

No

Expected behavior

Install-PowershellAzModules.ps1 script should be running without error

Actual behavior

Install-PowershellAzModules.ps1 script is failing with error

Repro steps

run Install-PowershellAzModules.ps1 script

@angaaruriakhil
Copy link

angaaruriakhil commented Jan 14, 2025

We have been having the same issue over the last two days. We have run close to 11 builds and kept hitting this issue, I thought it was some internal network problem until I saw that there is a CDN migration going on for PowerShell gallery endpoints. Presumably this is related to this.

See: PowerShell/PowerShellGallery#297, PowerShell/PowerShell#24734.

@Prabhatkumar59
Copy link
Contributor

Hi @antika080 - Thank you for bringing this issue to our attention. We will look into this issue closely and will update you after investigating.

@cgxxv
Copy link

cgxxv commented Jan 15, 2025

@Prabhatkumar59

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

https://learn.microsoft.com/en-us/powershell/azure/troubleshooting?view=azps-13.1.0#az-and-azurerm-coexistence

Seems azurerm need to be deleted. And also with the azure module

PS C:\Users\runner\runner-images> Import-Module .\images\windows\scripts\build\Install-PowershellAzModules.ps1
Installing azure to the C:\\Modules path...
 - 2.1.0 [C:\\Modules\azure_2.1.0]
 - 5.3.0 [C:\\Modules\azure_5.3.0]
WARNING: Package 'Azure' failed to be installed because: End of Central Directory record could not be found.
WARNING: Package 'Azure' failed to install.
PackageManagement\Save-Package : Unable to save the module 'Azure'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:11794 char:21
+             $null = PackageManagement\Save-Package @PSBoundParameters
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power...ets.SavePackage:SavePackage) [Save-Package], Exception
    + FullyQualifiedErrorId : ProviderFailToDownloadFile,Microsoft.PowerShell.PackageManagement.Cmdlets.SavePackage

@m-soltani
Copy link

Seeing the same issue.

@philip-lamb
Copy link

I could only get the image to build by removing all versions of the azure and azurerm modules.

@Prabhatkumar59
Copy link
Contributor

Hi @cgxxv - Thanks for all the inputs! We are looking into this issue closely and will update you after investigating. Appreciate your patience, thanks!

@m-soltani
Copy link

I could only get the image to build by removing all versions of the azure and azurerm modules.

yes, this worked for us as well. Don't know whether should call it a workaround or do these packages really need to be deleted.

@kishorekumar-anchala
Copy link
Contributor

kishorekumar-anchala commented Jan 16, 2025

The errors are due to using EOL versions. I recommend upgrading to the latest versions, as this should resolve the issues. We’re working on it.

Also, if possible, consider migrating to the Azure PowerShell module(Az) instead of the older AzureRM and Azure modules.

Let me know if you need any further info. Thank you!

cc @philip-lamb @cgxxv @m-soltani @angaaruriakhil @rcg-wae

@AtOMiCNebula
Copy link
Contributor

@kishorekumar-anchala

The errors are due to using EOL versions. I recommend upgrading to the latest versions, as this should resolve the issues.

The error is because the CDN is apparently delivering broken content (which itself is likely related to migrating CDNs behind the scenes), not because they're EOL. They've been EOL for a long time, but have been kept around because upgrading some of these modules brings lots of breaking changes to pipelines (#9980 (comment), among others). az can be updated because the modules are cached but not installed on the agent, whereas azurerm and azure are both cached and installed into the agent environment by default. This might not be a problem for your particular pipelines and/or environments, but it will be a problem at scale.

@kishorekumar-anchala
Copy link
Contributor

Hi @AtOMiCNebula - Thank you for your findings and efforts. We’ll be migrating to the Az module soon, and AzureRM and Azure will reach end-of-support on the runners. We’ll keep you updated. Thanks again!

@kishorekumar-anchala
Copy link
Contributor

kishorekumar-anchala commented Jan 17, 2025

Kindly fork the code and try to build , confirm with your comments. thank you !

cc @philip-lamb @cgxxv @angaaruriakhil @m-soltani @antika080

@habandy
Copy link

habandy commented Jan 17, 2025

@kishorekumar-anchala
Could be this a general issue? Facing this issue with the same error message from this comment above using ubuntu 22.04 build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants