I received the following error while installing Azure PowerShell Modules.
Install-Module -Name Az -AllowClobber
PackageManagement\Install-PackageProvider : No match was found
for the specified search criteria for the provider 'NuGet'.
The package provider requires 'PackageManagement' and 'Provider'
tags. Please check if the specified package has the tags.
Issue:
The issue, as I understand it, is that PowerShell by default uses TLS 1.0 for web requests and causing an issue in this case. So when the Install-Module command is trying to install the missing Package-Provider as a pre-requisite and AZ Modules itself, it’s failing! See step 3 to change the default to TLS 1.2
Solution:
Step 1: Check the PowerShell version installed and update it if required.
$PSVersionTable.PSVersion
Note: Azure PowerShell works with PowerShell 5.1 or higher on Windows, or PowerShell Core 6.x and later on all platforms. You should install the latest version of PowerShell Core available for your operating system. Azure PowerShell has no additional requirements when running on PowerShell Core.
To use Azure PowerShell in PowerShell 5.1 on Windows:
- Update to Windows PowerShell 5.1 if needed. If you’re on Windows 10, you already have PowerShell 5.1 installed.
- Install .NET Framework 4.7.2 or later.
- Make sure you have the latest version of PowerShellGet. Run
Update-Module PowerShellGet -Force
.
Step 2: Check if the NuGet package provider is installed
Get-PackageProvider -ListAvailable
Following is what I have initially, notice NuGet package provider is missing.
Step 3: Run the following command
The following will for the PowerShell to use TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Step 4: Re-Run Install-Module command
Install-Module -Name Az -AllowClobber
Note: The above command should have installed the missing package-provider as well and should look like the following. See highlighted.
References:
https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-3.8.0