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.
Table of Contents
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
}
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
- CategoryInfo : ObjectNotFound: (Microsoft.Power….InstallPackage: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.
2. Now You need to enable the Security Protocol Tls12, You can use the below command.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
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
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
}
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.
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
- Could not load file or assembly Microsoft.Extensions.DependencyInjection.Abstractions
- The Term ‘Connect-AzureRmAccount’ is Not Recognized
- The term ‘get-azuresubscription’ is not recognized
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 !!!.
I am Bijay, a Microsoft MVP (10 times) having more than 17 years of experience in the software industry. During my IT career, I got a chance to share my expertise in SharePoint and Microsoft Azure, like Azure VM, Azure Active Directory, Azure PowerShell, etc. I hope you will learn from these Azure tutorials. Read more