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 then I got the Azure Az Powershell module error i.e No match was found for the specified search criteria and module name ‘Az’. Below is the PowerShell script that I was executing 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
}
No match was found for the specified search criteria and module name Az

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]

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

Step-1: Now Open the PowerShell with Run as Administrator mode.

No match was found for the specified search criteria and
module name 'Az'. Try Get-PSRepository to see all available registered module repositories

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

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
No match was found for the specified search criteria and module name Az

Step-3: Now, once you execute the above command, Just to make sure the Security Protocol Tls12 is enabled for you or not. You can check running the below command.

[Net.ServicePointManager]::SecurityProtocol
powershell no match was found for the specified search criteria and module name 'az'

Step-4: Now try running the below PowerShell script again to install the Az module. You can able to see, the below PowerShell script ran successfully, and Now click on the Yes button for the confirmation on the installation.

if (Get-Module -Name AzureRM -ListAvailable) {
    Write-Warning -Message 'Azure module not installed.'
} else {
    Install-Module -Name Az -AllowClobber -Scope AllUsers
}
No package Az found

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

Step-5: Once you clicked on the Yes button, you can able to see it started installing the module.

Error installing the PowerShell Azure Module

So, this is how you can able to fix the Azure Az Powershell module error i.e No match was found for the specified search criteria and module name ‘Az’.

You may also like following the below Articles

Conclusion

Well, in this article, we saw How to fix the error Azure Az Powershell module error, No match was found for the specified search criteria and module name ‘Az’ which I got while trying to install the Az module using PowerShell ISE. Hope this helps you to fix your issue as well !!!.

Leave a Comment