Azure/AzureRM PowerShell 101

April 2, 2017 By Introductions No Comments

In our industry we have gotten used to an exponential rate of development and progress. The Azure family is no different and it’s easy to get lost. In this article we’re going to go through the basics of managing Azure via Powershell.

Azure PowerShell vs. AzureRM Powershell

Microsoft Azure PowerShell Module is the first version Microsoft released. It’s based on the old management portal and uses their terminology. Azure Powershell before 1.0 used these modules. Going forward Azure Resource Manager (ARM) technology is the common basis. Both the new portal and Azure Powershell v1.0+ use ARM. I recommend focussing on AzureRM modules wherever possible.

Connection to AzureRM Powershell

Install AzureRM Powershell from the Gallery if you haven’t done so yet.

Next you login to your account.

Take a look which subscriptions you have access to.

If you have more than one subscription select the subscription you want to manage.

Now you’re ready to execute any command you like. Any commands apply to the subscription you selected.

Common Parameters

There are a couple of parameters that can be appended to any cmdlet in Powershell.

The most common ones I use are:

This can be used to increase the output a command creates. Not all commands support it though.

For many commands this will output step-by-step programmer comments. It’s useful when the error output does not indicate where a problem occured. But be warned: You will often have to confirm every step before it occurs.

Some cmdlets may show errors during execution but continue nevertheless. You can override this behaviour and for example stop on any error ( -ea:Stop ). Or ask the user to decide. (-ErrorAction:Inquire).

Stores the output of the cmdlet into a variable ( -ov:variablename ) or appends it to one ( -OutVariable variablename ).

Note the long and short versions are interchangeable. Also you can specify a parameter with or without semicolon. For strings with spaces use quotation marks.