Microsoft provides Azure PowerShell cmdlets to manage Azure resources. During the initial launch of Azure PowerShell, Microsoft provided PowerShell cmdlets to manage some aspects of the Azure. In the new release of Azure PowerShell, Microsoft has enhanced the existing Azure PowerShell modules and also provided new PowerShell modules to interact with Azure services. Here’s how to install these new Azure PowerShell cmdlets.
Current Azure PowerShell version
Note that the earlier versions of Azure PowerShell could be used to manage classic and Resource Manager models in the Azure. However, considering Microsoft’s step to deprecate classic Azure model, the developers decided to rename the current version of Azure PowerShell to “Azure RM PowerShell”. The current version is Azure RM PowerShell 6.11.0.
Available methods for installing Azure PowerShell
Earlier versions of Azure PowerShell could be installed using Microsoft Web Platform Installer. However, Microsoft Web Platform Installer method is no longer an option available for users. Though Web Platform Installer is no longer an option, organizations will still require the package to be MSI format if they would like to deploy the package to multiple computers via GPO. The preferred method to install Azure PowerShell by using PowerShellGet method.
Installing Azure PowerShell using PowerShellGet
When it comes to installing Azure PowerShell using PowerShellGet, there are few requirements you need to meet and also follow a few steps to get it working. As to requirements, please make sure to meet the following items:
- Azure PowerShell 6.11.0 requires PowerShell version to be at 5.0. To make sure you are running the required version of PowerShell, please execute “$PSVersionTable.PSVersion”, which, in turn, shows the current version running on the PowerShell. In case you need to update the current version of the PowerShell, you can follow the instructions provided on this Microsoft site.
- You must have elevated privileges to install modules from PowerShellGet Gallery.
- The version of NuGet must be new. Any NuGet version earlier to 184.108.40.206 will be upgraded before the Azure PowerShell module installation starts.
To begin installing Azure PowerShell, execute this PowerShell command in an elevated PowerShell window:
Install-Module -Name AzureRM -AllowClobber
When you execute the above command, the process starts downloading all of the available Azure Resource Manager PowerShell cmdlets. Once the installation is done, all the Azure cmdlets will be available for use. Open a PowerShell window and run below PowerShell command, which in, turn, imports the available modules and make the environment ready for use.
Once the modules have been imported successfully, you can test Azure PowerShell by executing Connect-AzureRMAccount or similar PowerShell cmdlet.
Installing Azure PowerShell using MSI
As stated earlier, Microsoft does not provide Web Installer Platform which used to be the preferred way to install Azure PowerShell on Windows computers. Instead, GitHub provides MSI files for the latest version of Azure PowerShell. You can download MSI files and install them on a local computer or use it for distribution to multiple computers via Group Policy. The Azure PowerShell MSI files at GitHub is available here.
Azure PowerShell for both Azure Classic and Azure RM Models
In case you have resources running in both Azure Classic and Resource Manager models and if you would like to keep two versions of Azure PowerShell, you can install the older version by adding “-RequiredVersion” parameter during the installation as shown in the command below:
Install-Module –Name AzureRM –RequiredVersion 1.2.9
The above command installs Azure PowerShell version 1.2.9 by making sure the current version of Azure PowerShell is untouched. In case you need to see the number of Azure PowerShell versions you have installed on the computer, just execute below PowerShell command:
Get-Module -Name AzureRM -List | select Name,Version
Important: When you import Azure PowerShell version in PowerShell window, by default the latest version is imported. To import a version of your choice you must provide the “-RequiredVersion” parameter as shown in the command below:
Import-Module -Name AzureRM -RequiredVersion 1.2.9
Hopefully, you will find these new and enhanced Azure PowerShell cmdlets useful.