In this azure tutorial, we will discuss how to fix the error, Unable to find package providers (NuGet), and No match was found for the specified search criteria and provider name ‘NuGet’. Try ‘Get-PackageProvider -ListAvailable’ to see if the provider exists on the system which comes while trying to install the PowerShell Nuget and Azure PowerShell module using PowerShell ISE.
Table of Contents
- Unable to find package providers (NuGet)
- Unable to install NuGet provider for PowerShell
- Find the PowerShell version
- Check the Transport Layer Security protocols
- Unable to find package providers (NuGet) [Solved]
- Install-PackageProvider
- No match was found for the specified search criteria and provider name ‘NuGet’. Try ‘Get-PackageProvider -ListAvailable’ to see if the provider exists on the system.
Unable to find package providers (NuGet)
Recently, while I was trying to install PowerShell Nuget, I got this error “Unable to find package providers (NuGet)“. I was executing the PowerShell script to install PowerShell Nuget and I got this error
When I was trying to install the ‘Nuget’ package using the below PowerShell cmdlet, I got the above error
I was executing the below line of code to install Nuget PowerShell.
$_nugetUrl = "https://api.nuget.org/v3/index.json"
$MypS = Get-PackageSource
if(@($MypS).Where{$_.location -eq $_nugetUrl}.count -eq 0)
{
Register-PackageSource -Name MyNuGet -Location $_nugetUrl -ProviderName NuGet
}
Unable to install NuGet provider for PowerShell
I got the below error “Unable to find package providers (NuGet)“, see below Powershell not able to access “NuGet” package
Why are we exactly getting this error Unable to install NuGet provider for PowerShell and what is the solution for Unable to find package providers (NuGet)?
Find the PowerShell version
You should always use the updated version of PowerShell. You need to run the below PwerShell cmdlet to check the PowerShell version on your system.
PS C:\WINDOWS\system32> Get-Host | Select-Object Version
Check the Transport Layer Security protocols
Let’s check the Transport layer security protocols on the system
PS C:\WINDOWS\system32> [Net.ServicePointManager]::SecurityProtocol
Once, you will run the above PowerShell cmdlet, you can see the version of Transport layer security protocols available on your system. If the versions are old and deprecated one then you need to enable at least TLS 1.2 or above.
Unable to find package providers (NuGet) [Solved]
Install-PackageProvider
To fix ,Unable to install NuGet provider for PowerShell, we need to follow the below steps to fix Unable to install NuGet provider for PowerShell
Step- 1:
Open PowerShell as run as Administrator
Step- 2:
Run the below command to enable TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Step- 3:
Run the below command
Install-PackageProvider -Name NuGet
See the output here
This is how we can fix the error Unable to find package providers (NuGet) or Unable to find package provider ‘NuGet’ and this is How do I install the Nuget Provider for PowerShell.
No match was found for the specified search criteria and provider name ‘NuGet’. Try ‘Get-PackageProvider -ListAvailable’ to see if the provider exists on the system.
Recently, while I was trying to install the Azure Powershell module I got this error. I was executing the below line of code and I got the above error
if (Get-Module -Name AzureRM -ListAvailable) {
Write-Warning -Message 'Azure module not installed.'
} else {
Install-Module -Name Az -AllowClobber -Scope AllUsers
}
Ohh, again I am getting the same error
Now to fix this we need to follow the below steps
Step-1:
To fix this error, First, we need to install the ‘Nuget’ package by following the above steps.
Step- 2:
Then run the below command which will De-register and register the repository again.
Register-PSRepository -Default
Step- 3:
Now run the below line of code to install the Azure PowerShell module. Now you will not get any error this time. This will install the Azure PowerShell module successfully.
if (Get-Module -Name AzureRM -ListAvailable) {
Write-Warning -Message 'Azure module not installed.'
} else {
Install-Module -Name Az -AllowClobber -Scope AllUsers
}
See below
Step- 4:
Now you can see below it started installing the Azure PowerShell module.
You may like following Azure tutorials:
- What is Microsoft Azure and How does Microsoft Azure Works?
- Azure active directory premium features
- How to Create Azure Free Account (Step by Step tutorial)
- The term ‘get-aduser’ is not recognized as the name of a cmdlet in Windows 10 PowerShell
- How to Create a Recovery Services vault in Azure
- The ‘New-AzResourceGroup’ command was found in the module ‘Az.Resources’, but the module could not be loaded
Conclusion
In this article, we learned to fix the error “Unable to find package providers (NuGet)“. The solution to this issue is configuring TLS1.2 on the system. After that, you can install NuGet for PowerShell without any issue. I hope this Azure tutorial, helps you to fix the error Unable to find package providers (NuGet). The same solution will also fix the below errors
- unable to find package provider ‘NuGet’ PowerShell
- get-packageprovider : unable to find package provider ‘NuGet’
- install PowerShell NuGet provider
- Install-PackageProvider
- PowerShell install NuGet provider
- Powershell not able to access packages / “NuGet” package provider
- Powershell not able to access packages / “NuGet” package provider after security configuration update
- How do I install the Nuget provider for PowerShell
We also discussed the solution for the issue No match was found for the specified search criteria and provider name ‘NuGet’. Try ‘Get-PackageProvider -ListAvailable’ to see if the provider exists on the system which I got while trying to install the Azure PowerShell module.