8
$ Get-InstalledModule -Name Az -AllVersions

Version    Name                                Repository           Description
-------    ----                                ----------           -----------
0.5.0      Az                                  PSGallery            Azure Resource Manager Module. Cmdlets to manage...

Above block shows that Az is installed.. But following block says otherwise:

$ Update-Module -Name Az
WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'Az'. Try
Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2089 char:20
+ ...           $sid = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
   ception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
4c74356b41
  • 69,186
  • 6
  • 100
  • 141
Deepak Singhal
  • 10,568
  • 11
  • 59
  • 98

3 Answers3

5

Thanks for help to everyone in comments... Here the main problem was the repository itself.. De-registering and registering it back solved the issue.

> Register-PSRepository -Default
Deepak Singhal
  • 10,568
  • 11
  • 59
  • 98
1

Using TLS1.2 connection solved the issue. Try executing below command before installing module Az-

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 

Install-Module -Name Az -AllowClobber -Scope CurrentUser
v.t.
  • 41
  • 2
0

In my case the following ways are not in effect.

  • [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  • Register-PSRepository -Default

I resolved by installing newer version of AzureRM.

PS> Install-Module -Name AzureRM -AllowClobber

Youngsan
  • 1
  • 1