AzureTip — Fixing Azure Powershell Install issues
I predominantly work on MAC so I use Azure CLI to get my work done. Recently I had to work on Azure Powershell modules and it took me a while to figure out the right commands to install Azure Powershell modules successfully.
5 simple steps to install Azure Powershell
- Go to https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-3.8.0
- $PSVersionTable.PSVersion
3. Install-Module -Name Az -AllowClobber
The following error didn’t made sense to me as I have internet connectivity on my Windows VM.
WARNING: Unable to download from URI ‘https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ‘’.
WARNING: Unable to download the list of available providers. Check your internet connection.
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.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7405 char:21
+ … $null = PackageManagement\Install-PackageProvider -Name $script:N …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Power…PackageProvider:InstallPackageProvider) [Install-PackageProvider], Exception
+ FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider
The issue, as I understand it, is that PowerShell by default uses TLS 1.0 for web requests and the target website expects TLS1.2. So this needs to be changed. Thankfully, this is an easy change. Just add the following line to your scripts:
4. [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Now I hit another error.
Executing the below command fixed this issue.
6. Set-PSRepository -Name “PSGallery” -InstallationPolicy Trusted
7. Install-Module -Name Az -AllowClobber
Viola!!!. You can now sign in to your Azure account
# Connect to Azure with a browser sign in token
Connect-AzAccount