No match was found for the specified search criteria and module name ‘Az’

In this Azure tutorial, we will discuss how to fix the error. No match was found for the specified search criteria and module name ‘Az’. which comes while trying to install the Azure PowerShell Az module using PowerShell in Azure.

No match was found for the specified search criteria and module name ‘Az’

Recently, for some of the Operations in Azure using the PowerShell ISE, I was trying to run the PowerShell script to install the Az module for PowerShell and then I got the Azure Az Powershell module error, i.e., no match was found for the specified search criteria and module name. Below is the PowerShell script I executed to install the Az PowerShell module.

if (Get-Module -Name AzureRM -ListAvailable) {
    Write-Warning -Message 'Azure module not installed.'
} else {
    Install-Module -Name Az -AllowClobber -Scope AllUsers
}
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.

The exact error message was as below

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:1809 char:21

  • … $null = PackageManagement\Install-Package @PSBoundParameters
  • ~~~~~~~~~~~~
    • CategoryInfo : ObjectNotFound: (Microsoft.Power….InstallPackage:InstallPackage
      ) [Install-Package], Exception
    • FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cm
      dlets.InstallPackage

No match was found for the specified search criteria and module name ‘Az’ [Solved]

To fix the error, No match was found for the specified search criteria and module name ‘Az’. You need to follow the below steps.

1. Now Open the PowerShell with Run as Administrator mode.

packagemanagement\install-package : no match was found for the specified search criteria and module name

2. Now You need to enable the Security Protocol Tls12, You can use the below command.

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
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.

3. Once you execute the above command, ensure the Security Protocol Tls12 is enabled for you or not. You can check by running the below command.

[Net.ServicePointManager]::SecurityProtocol
install-package: no match was found for the specified search criteria and module name

4. Now try running the below PowerShell script again to install the Az module. You can see that the below PowerShell script ran successfully. and Now click on the Yes button for confirmation of the installation.

if (Get-Module -Name AzureRM -ListAvailable) {
    Write-Warning -Message 'Azure module not installed.'
} else {
    Install-Module -Name Az -AllowClobber -Scope AllUsers
}
no match was found for the specified search criteria

Note: if you are still facing the same issue after executing the above script then, try running the below command now and run the above script again.

Register-PSRepository -Default

5. Once you click on the Yes button, you can see it started installing the module.

no match was found for the specified search criteria and module name 'az'. try get-psrepository to see all available registered module repositories.

So, this is how you can fix the Azure Az Powershell module error i.e. no match was found for the specified search criteria.

You may also like following the below Articles

Conclusion

Well, in this article, we saw How to fix the error 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., which I got while trying to install the Az module using PowerShell ISE. I hope this helps you to fix your issue as well !!!.