Skip to main content

Az PowerShell Module for Azure

Author by Mitchell Grande

Back in December of last year, a brand new version of the Azure PowerShell module was released into general availability.  This new module is called "Az" and is replacing the AzureRm module.

What's Changing

The new Az module is now the preferred way to use PowerShell with Azure.  The AzureRm module will not receive any new features or major updates.  This means that as Microsoft releases new Azure features and functionality, you will not be able to manage or configure them via the old module.  You must switch to the new Az module to take advantage of features going forward.  The legacy AzureRm module will receive bug and security fixes through December 2020.

Az is built on the .NET standard library which makes it cross-platform compatible.  You can install and use the Az module on Windows, Linux, or macOS.

Additionally, all of the cmdlet names have been shortened.  Instead of using AzureRm, they've been shortened to just Az.  For example, instead of Get-AzureRmVM, there's Get-AzVM.  Since the change in cmdlet names will break existing scripts and functionality, Az includes a Compatibility Mode that creates aliases to map the old cmdlet names to the new ones.  This enables existing scripts and functions to work with the old names, while taking advantage of the new Az module.  Even with this enabled, it is recommended that existing scripts be converted to use the new cmdlet names directly.

Installing and Migrating to Az

The recommended steps to migrate from the AzureRm module to the Az module are:

  1. Uninstall the AzureRm module
  2. Install the Az module, using the PowerShell command: Install-Module -Name Az -AllowClobber
  3. If desired, enable Compatibility Mode with AzureRm commands with the PowerShell command: Enable-AzureRmAlias
    1. This will create aliases to map the AzureRm cmdlet names with the new Az cmdlet names.  This allows existing scripts and functions to work without any major changes.

Note that you are not required to uninstall the AzureRm module before installing the Az module.  However, if you have both modules installed, do not use the Enable-AzureRmAlias command to enable aliases.  Unexpected behavior will result.

For more information on the migration process, read the official documentation on the procedure.

Changes to Authentication

If you have an older version of the Az module, using Login-AzAccount to login will produce a warning similar to this:


In the original releases of the Az module, you had to switch from the PowerShell window to your browser to authenticate.  This required you to enter the given code into the Microsoft login page and complete the authentication process.  This was changed in the January release of the Az module.  If you are still getting this prompt, upgrading your module to version 1.2.0 or later will switch to the old behavior of popping up the authentication window right from PowerShell.

Note that this authentication flow is still in use for non-Windows clients or Windows clients with an outdated version of PowerShell.

Common Commands

To help get started, here are some common AzureRm commands and their replacement:​

#Get the current context (logged in user and active subscription)
Get-AzureRmContext #Old command
Get-AzContext #New command

#List the resources groups in the current subscription
Get-AzureRmResourceGroup #Old command
Get-AzResourceGroup #New command

#Get the VM named "TESTVM01" in the resource group "TestRG01"
Get-AzureRmVM -ResourceGroupName TestRG01 -Name TESTVM01 #Old Command
Get-AzVM -ResourceGroupName TestRG01 -Name TESTVM01 #New command

#List the storage accounts in the current subscription
Get-AzureRmStorageAccount #Old command
Get-AzStorageAccount #New command

As you can see, each command is the same except for swapping AzureRm with Az.


For more information on the Az module, see the official documentation


Mitchell Grande

Systems Engineer

Tags in this Article