Tuesday, March 01, 2016

The AzureRM module–Post the Great Renaming

Last summer (2015), the Azure PowerShell team took the decision to re-factor the then existing Azure module. You may remember, this older module was schitzophrenic – loading the modjule allowed you access to the Azure Service Management APIs. You then used the Switch-AzureMode cmdlet to enable access to the Resource Manager APIs.

Many PowerShell hands felt this was a sub-optomal approach. A more senible approach, the arugment went, would be to create a separate module (or separate modules!). The latter is what happend – ALL the RM cmdlets were removed from the old Azure Module (an updated module – which at the time of writing is version 1.0.4) is available that contains only  cmdlets that target the Service Manager APIs. At the same time, the Azure PowerShell team created a bunch of new, Resource Manager targeted cmdlets.

Another somewhat curious decision was made with respect to these cmdlets. The team created a simple module, AzureRM, whch contains cmdlets that actually to the installation and updating of the individual modules. You use the AzureRM module to actually install anbd manage the RM commands.

This means that the installation of the Resource Manager cmdlets is a two step affair. First, get the main RM module:

Install-Module AzureRM

This goes out to the PSGallery and obtains the latest version of this module. At the time of writing, this is version 1.0.4, but no doubt will change on a regular basis! The AzureRM module contains just 8 commands (1 alias, and 7 functions to be accurate) that enable you to manage the detailed sub-modules.  So once you have the AzureRM module installed, you can install the actual Azure RM Modules by


Strictly speaking, Install-AzureRM is an alias for Update-AzureRM. You can use either to install teh individual modules. The AzureRM module also has a command to uninstall the module as well as updating the module.

To check what modules you have on yoru system, you can do this:

Get-Module AzureRM.* -ListAvailable

And, of course, when you want to update the modules that make up the AzureRM set of modules, just:


This is a slightly different way to install/manage these modules than many of you may be used to using. But it does give the Azure PowerShell team more flexibility – to create new modules to match new Azure features and to update bits of the module set at a time. At the same time, you end up with 27 separater modules with 5 separate release versions. Keeping track of these will be work, since in some cases, updates may break earlier code.

Once you have all this done, you end up wsith 884 commands, as follows:

PSH [C:\foo]: get-command -module azurerm.* | measure | select count

PSH [C:\foo]: get-command -module azurerm.* | group commandtype

Count Name                      Group
----- ----                      -----
    6 Alias                     {Get-AzureRmSqlDatabaseServerAuditingPol…
    1 Function                  {Get-AzureRmAuthorizationChangeLog}
  877 Cmdlet                    {Add-AlertRule, Add-AutoscaleSetting….

No comments: