Azure PowerShell is a set of modules that allow you to manage Microsoft Azure from the PoSh command line. These modules used when creating and configuring cloud services, managing virtual machines, networks, web applications, and other Azure resources. In this article, we will show how to install Azure PowerShell on Windows 10.
The easiest way to install Azure PowerShell Modules is to install it from the PowerShell Gallery using PowerShellGet.
Hint. There are currently two modules for managing Azure: Azure Az and AzureRM. AzureRM was released in December of 2018 and is currently deprecated. Therefore, for now, you only need to use the Azure Az module. If you have AzureRM installed on your computer, uninstall it with the command:Uninstall-Module -Name AzureRm -AllVersions
- Windows PowerShell version 5.1 or newer should be installed on your computer. On Windows 10, PowerShell 5.1 is installed by default. You can check the current PowerShell version with the command: $PSVersionTable.PSVersion On Windows 8.1 and Windows Server 2012 R2, Windows Management Framework 5.0 must be installed to upgrade to PowerShell 5.1;
- .NET Framework 4.7.2 or newer must be installed on your device. If the following PowerShell script returns True, it means that .Net 4.7.2 or higher is installed:
(Get-ItemProperty -Path 'HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full' -ErrorAction SilentlyContinue).Release -ge 461808
- PowerShellGet 126.96.36.199 or higher must be installed on your computer. Check the current version with the command:
Get-Module -Name PowerShellGet -ListAvailable | Select-Object -Property Name,Version,Path
In our example, PowerShellGet version 188.8.131.52 is installed. Update it with the command:
Install-Module PowerShellGet –Force
You are now ready to install the Azure PowerShell modules. Microsoft recommends installing Azure PowerShell only for an active user of the computer with the command:
Install-Module -Name Az -AllowClobber -Scope CurrentUser
You will receive a warning about using an untrusted repository. You need to select Yes or Yes to All:
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from ‘PSGallery’?
Then confirm the NuGet installation.
If you want to install Azure Module for all users of the computer, run:
Install-Module -Name Az -AllowClobber -Scope AllUsers
To check if the Azure Az module is installed on your computer (and to check its version) use the command:
Get-InstalledModule -Name Az | select Name, Version
To update the Azure AD PowerShell Module to the latest version, run the command:
Update-Module -Name Az
To import the installed Az module into the current PowerShell session, run the command:
Import-Module -Name Az
You are now ready to connect to your Azure tenant. Run the command:
Log in with your credentials (it’s recommended using MFA).
If your account is associated with multiple Azure tenants, or your status is Cloud Solution Provider (CSP), you can specify the tenant ID to connect:
Connect-AzAccount -Tenant '****-****-****-****’
You can list the subscriptions available to your account using the command:
- How to Fix PFN_LIST_CORRUPT Blue Screen of Death in Windows 10? - June 20, 2021
- How to Prevent/Allow Log on Locally via GPO? - June 19, 2021
- Deploying Local Administrator Password Solution (LAPS) in Active Directory - June 19, 2021