Asked by:
Unable to Install Azure AD

Question
-
Hi, We are trying to install the AzureAD module. Not able to install the module.
PS C:\Windows\system32> Install-Module AzureAD
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/AzureAD/2.0.2.4' is not valid.
PackageManagement\Install-Package : Package 'AzureAD' 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\r...D\AzureAD.nupkg:String) [Install-Package], Excep
tion
+ FullyQualifiedErrorId : PackageFailedInstallOrDownload,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPac
kage
Friday, November 30, 2018 8:05 AM
All replies
-
Friday, November 30, 2018 8:15 AM
-
Thanks.
Any idea then why we are not able to install the Azure AD.
The source is same for us as well but giving the warning.
WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/AzureAD/2.0.2.4' is not valid
Friday, November 30, 2018 8:21 AM -
Try:
Find-Module AzureAD
\_(ツ)_/
Friday, November 30, 2018 8:28 AM -
Its working.
PS C:\Windows\system32> Find-Module AzureAD
Version Name Repository Description
------- ---- ---------- -----------
2.0.2.4 AzureAD PSGallery Azure Active Directory V2 General Availability M...Friday, November 30, 2018 8:34 AM -
Now:
Find-Module AzureAD | Save-Module -Path c:\temp
\_(ツ)_/
- Edited by jrv Friday, November 30, 2018 9:13 AM
Friday, November 30, 2018 8:40 AM -
Its not working.
PS C:\Windows\system32> Find-Module | Save-Module -Path c:\temp
WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/AzureRM.profile/5.8.2' is not valid.
WARNING: Package 'AzureRM.profile' failed to download.
WARNING: Package 'AzureRM.profile' failed to install.
PackageManagement\Save-Package : Unable to save the module 'AzureRM.profile'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1622 char:25
+ ... $null = PackageManagement\Save-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Power...ets.SavePackage:SavePackage) [Save-Package], Exception
+ FullyQualifiedErrorId : ProviderFailToDownloadFile,Microsoft.PowerShell.PackageManagement.Cmdlets.SavePackage
WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/AzureRM.profile/5.8.2' is not valid.
WARNING: Package 'AzureRM.profile' failed to download.
WARNING: Dependent Package 'AzureRM.profile' failed to install.
WARNING: Package 'Azure.Storage' failed to install.
PackageManagement\Save-Package : Unable to save the module 'Azure.Storage'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1622 char:25
+ ... $null = PackageManagement\Save-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Power...ets.SavePackage:SavePackage) [Save-Package], Exception
+ FullyQualifiedErrorId : ProviderFailToDownloadFile,Microsoft.PowerShell.PackageManagement.Cmdlets.SavePackageFriday, November 30, 2018 8:54 AM -
Your command is wrong. Sorry I typed it wrong.
Find-Module | Save-Module -Path c:\temp
This is correct:
Find-Module AzureAD | Save-Module -Path c:\temp
Be sure to save to a temp folder and not to any real location. This is just a test.
\_(ツ)_/
- Edited by jrv Friday, November 30, 2018 9:13 AM
Friday, November 30, 2018 9:12 AM -
Thanks.
PS C:\Windows\system32> Find-Module AzureAD | Save-Module -Path c:\temp
WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/AzureAD/2.0.2.4' is not valid.
WARNING: Package 'AzureAD' failed to download.
WARNING: Package 'AzureAD' failed to install.
PackageManagement\Save-Package : Unable to save the module 'AzureAD'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1622 char:25
+ ... $null = PackageManagement\Save-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Power...ets.SavePackage:SavePackage) [Save-Package], Exception
+ FullyQualifiedErrorId : ProviderFailToDownloadFile,Microsoft.PowerShell.PackageManagement.Cmdlets.SavePackageFriday, November 30, 2018 9:24 AM -
Are downloads blocked for your network? What version of PS? The old version of PowerShellGet will not work correctly on the newer repository. THe latest version is 1.6.7. It appears you are using 1.0.0.1
\_(ツ)_/
Friday, November 30, 2018 9:29 AM -
This should be able to update your version:
install-module powershellget -force
\_(ツ)_/
Friday, November 30, 2018 9:34 AM -
Hi, Not able to update the version. Same download error.
PS C:\Windows\system32> install-module powershellget -force
WARNING: Source Location 'https://www.powershellgallery.com/api/v2/package/PackageManagement/1.2.3' is not valid.
PackageManagement\Install-Package : Package 'PackageManagement' 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\rarora...anagement.nupkg:String) [Install-Package], Exception
+ FullyQualifiedErrorId : PackageFailedInstallOrDownload,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageFriday, November 30, 2018 9:41 AM -
You still haven't answered my questions.
Also add the version of Windows.
\_(ツ)_/
Friday, November 30, 2018 9:44 AM -
Windows Server 2016 Datacenter
PS C:\Windows\system32> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 14393 2608
Friday, November 30, 2018 9:48 AM -
Then I would say that you have network issues or a system problem.
Search for articles on how to manually upgrade PowerShellGet to the latest version and do a manual upgrade. That should fix the version but the net or system could still bee a problem.
\_(ツ)_/
Friday, November 30, 2018 10:13 AM -
Thanks
Could you think of any specific system problem in this case. Internet is allowed on the server without any restriction.
Friday, November 30, 2018 12:07 PM -
Ensure *.azureedge.net is not blockedFriday, November 30, 2018 2:23 PM
-
Yes, it is accessibleFriday, November 30, 2018 2:44 PM
-
Does the below command connect?
invoke-webrequest -uri "https://www.powershellgallery.com/api/v2/package/PackageManagement/1.2.3"
Friday, November 30, 2018 3:13 PM -
All of this was tested when we first ran "Find-Module". The issue is the old version of the module or the net is blocking downloads.
\_(ツ)_/
Friday, November 30, 2018 3:43 PM -
PS C:\Windows\system32> invoke-webrequest -uri "https://www.powershellgallery.com/api/v2/package/PackageManagement/1.2.3
"
invoke-webrequest : Unable to connect to the remote server
At line:1 char:1
+ invoke-webrequest -uri "https://www.powershellgallery.com/api/v2/pack ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommandFrom the browser - https://www.powershellgallery.com is reachable
Tuesday, December 4, 2018 10:25 AM -
You have no access to that file. It is possible that you firewall is blocking the file extension which is "nupkg".
Put the whole URL in the browse. It should download the following file:
packagemanagement.1.2.3.nupkg
\_(ツ)_/
Tuesday, December 4, 2018 12:44 PM -
Is your web traffic through proxy only? If you're not sure check your browser settings. You will need to tell your PS cmdlets that support the option to use the proxy.Tuesday, December 4, 2018 2:02 PM
-
In case anybody comes across years later (as I did)
I needed to issue first in PS
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
as per this
Tuesday, April 7, 2020 3:58 PM -
In case anybody comes across years later (as I did)
I needed to issue first in PS
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
as per this
\_(ツ)_/
Tuesday, April 7, 2020 4:07 PM -
Maybe, but I did run in on Server 2012 R2....Wednesday, April 8, 2020 6:43 AM
-
Maybe, but I did run in on Server 2012 R2....
Your issue has nothing to do with the question in this thread.\_(ツ)_/
Wednesday, April 8, 2020 8:04 AM