Introduction to Azure PowerShell Az

There’s a new Azure PowerShell module called ‘Az’ that is recently announced. It brings out the true power of PowerShell core and Cloud Shell to maintain compatibility with PowerShell 5.1. The term Az is the short form of the word Azure.

New Features in Azure Az

  • Cross-platform
  • Compatibility with Azure Rm
  • Device code Authentication
  • Cloud shell enabled
  • Updates every two weeks.

The Login popup is a hazard for every PowerShell scripter. With this new release, the sign will be automatically redirected to a device login page and enter the code provided by the PowerShell console to grant access. This is so-called Device Code Authentication.

Device Login

Say goodbye to AzureRM

Don’t worry. Your existing scripts that use AzureRM will still continue to work fine and will be supported and any important bugs will be fixed, but new Azure Features and capabilities will be shipped only with Az starting December 2018.

If you would like to continue using AzureRM for your existing scripts while also writing new scripts using Az then you have two possible options.

  • Install PowerShell Core 6

    • To install PowerShell core refer docs
  • Explicit module loading

    • First of all Load the mandatory modules that your script uses at the beginning of the script.

Migrating from AzureRM

Azure recommends the existing AzureRM module users to migrate from Rm to Az. To make the upgrade easier for existing scripts, Azure provides cmdlets that can create Aliases and map the old cmdlet names from AzureRM — > into appropriate names for Az and it can work without any script change.

Enable-AzureRmAlias: It enables the AzureRM aliases in the current session for the AzureAz. You can also use a scope with flags like -CurrentUser and -LocalMachine.

Note: Any script that imports the modules directly should be modified to the appropriate Az module.

AzureRM and Az on the same machine

It’s not possible to import both modules side by side in the same session. But if you want the Az, install Az in PowerShell Core and leave AzureRM in Windows PowerShell.

Note: To install Az in PowerShell core you should have .NET Framework 4.7.2 or later.

Therefore, to Install the Az module in PowerShell core visit the following documentation

Example for module changes

In AzureRM, cmdlets used either AzureRM or Azure as a noun prefix. For example:

Get-AzureRmStorageAccount ->> Get-AzStorageAccount

Get-AzureRmWebApp ->> Get-AzWebApp

Fellow PowerShell comrades and scripters who need more breaking changes and migration guide certainly visit Github

Hence the full list of all available modules in Az are here in docs

If you like this post, you might also interested in PowerShell and for more blogs stay tuned to TechMeet360

Author: Hariharan subramanian

Software Engineer. c# and Azure Enthusiast.Passionate about Biking and Travelling.

Get notified about any future events

Interested in learning more about TechMeet360 or knowing about any future events? Sign up below to get notified.

Back to Top