Forum Discussion

FineSL60's avatar
FineSL60
Copper Contributor
Apr 08, 2020

Failed downloading Az and other modules for powershell

Hello,

 

I am attempting to install the Az module for powershell. I haven't had issues in the past but now I get errors when trying to do so and I have tried many ways to do this.

 

It seems like an issue on the powershellgallery site but I am not 100% sure.

 

Here's my situation

  • On the machine as an administrator
  • Running powershell.exe as an adminsitrator
  • Attempting this on a client server and a local server (where I previously was able to do this) so does NOT appear to be proxy, firewall or security related in any way
  • I click yes to run from untrusted repository (always have, never been an issue)
  • I receive the follow error:
    • WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/Az.Accounts/1.7.4' is not valid.
    • PackageManagement\Install-Package : Package 'Az.Accounts' failed to download.
    • At C:\Program Files\WindowsPowershell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21
    • + ...              $null = PackageManagement\Install-Package @PSBoundParameters
    • +                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • + CategoryInfo          : ResourceUnavailable: (C:\Users\{username}....Accounts.nupkg:String) [Install-Package], Exception
    • + FullyQualifiedErrorId : PackageFailedInstallOrDownload,Microsoft.Powershell.PackageManagement.Cmdlets.InstallPackage

I have attempted many of the switches -Force -AllowClobber  etc ... attempted to install by downloading locally but not sure I am doing that right as it doesn't seem to work with the instructions I have found around the web.

 

This started sometime last week, perhaps Thursday.

 

I'm at a loss, been trying this for way too long.

 

Any insight?

 

Thanks ahead of time!

 

S

  • Chalaneru's avatar
    Chalaneru
    Apr 10, 2020

    Hi, FineSL60esunilkumare 

     

    I received the same error message but I managed to solve it by swicthcing to TLS 1.2:

    PS C:\> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

     

     

    Then:

     

    Regards,

  • esunilkumare's avatar
    esunilkumare
    Copper Contributor

    Team,

     

    I am also facing the same issue. I have admin privileges and running PS as admin.

     

    PFB the error scenario.

     

    Tried to access the link https://www.powershellgallery.com/api/v2/package/Az.Accounts/1.7.4 via IE on the machine and the package az.accounts.1.7.4.nupkg is getting downloaded without any issue. Hence it seems to be an issue with PS only, as PC can access the link.

     

    Any suggestions would be deeply appreciated.

     

    --

    Thanks

    Sunil

     

    • Chalaneru's avatar
      Chalaneru
      Brass Contributor

      Hi, FineSL60esunilkumare 

       

      I received the same error message but I managed to solve it by swicthcing to TLS 1.2:

      PS C:\> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

       

       

      Then:

       

      Regards,

      • CyberGiene's avatar
        CyberGiene
        Copper Contributor

        Chalaneru saved me a whole bunch of time not having to dig through event logs to figure this out .. thank you so much :cool:

  • Ravindrakashid's avatar
    Ravindrakashid
    Copper Contributor

    FineSL60

    Use below command if you are trying to install Az module for powershell.

     

    Install-Module az -Scope CurrentUser -Force 

     

  • secDM's avatar
    secDM
    Copper Contributor

    FineSL60 Register your repository? If registered, de-register and re-add. 

     

    Register-PSRepository -Default 

     

     

    • FineSL60's avatar
      FineSL60
      Copper Contributor
      Thanks for the response. It did not make a difference at this point.
      • secDM's avatar
        secDM
        Copper Contributor

        FineSL60 Were you given any type of error again you can post a screen shot of?

Resources