A few weeks ago Microsoft introduced a major update for the Azure PowerShell: The Azure PowerShel Az module. This update brings the commandlets closer to the Azure CLI (az vs. Az). Maybe you’re asking yourself the question: What happens to the existing PowerShell scripts now?
Introduction to Az module
The Azure PowerShell Az module was released in December 2018. It uses the .NET Standard Library and could run on PowerShell 5.x and 6.x. Thus the module also runs on Linux and MacOS.
For me, one of the most interesting new features has been the authentication. An interactive browser login has been added. Further updates on authentication will follow in early 2019.
You should check out the roadmap for detailed information.
Az module – Features
Compared to AzureRM, Az offers shorter commands, improved stability, and cross-platform support. Az is a new module, so the version has been reset to 1.0.0.
- Az is a replacement for AzureRM and AzureRM.Netcore.
- the module runs on PowerShell 5.1 and PowerShell Core.
- it is always up to date with the latest tooling for Azure services.
- Az shortens and normalizes cmdlet names.
The “old” vs the “new” command will look like this:
PS C:\>Set-AzureRMApplicationGateway (old) PS C:\>Set-AzApplicationGateway (new)
Compatibility / Migration from AzureRM Scripts to Az Scripts
To migrate existing scripts from AzureRM to Az, Microsoft provides “aliases” which map the AzureRM to Az commandlets. This makes it possible for AzureRM scripts to work without customizations.
Use the following command to enable AzureRM aliases:
PS C:\> Enable-AzureRmAlias
Please be aware of some module changes which are directly importet through scripts. You can verify the complete list on the GitHub Page of the Az Module.
Note: You can have installed the AzureRM and the Az module at the same time. If you want to do so, do NOT enable the “aliases” mode. Microsoft recommends to uninstall the AzureRM module to do a fresh installation of the Az module.
Fresh installation of Az Module
Anyway, I recommend to uninstall the AzureRM module before installing the Az module.
PS C:\> Uninstall-AzureRm
To install the module, use the following command:
PS C:\> Install-Module -Name Az -AllowClobber
If you do not have admin-privileges use the option “-Scope CurrentUser”.
After that you can start the Login into your Azure environment simply use the command:
PS C:\> Connect-AzAccount
By pasting the link into the browser, the login-Screen will look like this:
Finally, it is highly recommend to check for module updates in short time periods to ensure that you are using the latest version. The command for updates is
PS C:\> Update-Module -Name Az
That’s all you need to know about the new Azure PowerShell Az module. Have you tried it already?