Powershell and Azure – how to begin?

I want to share with you my beginner experience with Azure Powershell module.
Microsoft Azure is one of the most popular public cloud provider in the world.
Platform is available in 38 regions ( and still growing). For those who didn’t check yet this I strongly recommend Azure docs site where all documentation reside.
Azure Powershell is divided into two models.
ARM – Azure Resource Manager (for more read about Resource groups).
It’s a new approach for managing cloud infrastructure (connected with new azure portal – portal.azure.com) and all new cmdlets for Azure will be developed in this model.
To add Azure ARM module run Powershell as Administrator and install using below command.
Install the Azure Resource Manager modules from the PowerShell Gallery

Install-Module AzureRM

ASM -Azure Service Manager (old portal manage.windowsazure.com)
Install the Azure Service Management module from the PowerShell Gallery

Install-Module Azure

Login to azure resource manager

Login-AzureRmAccount -Credential $cred

Login to azure service manager


Gather Azure subscribtion

Get-AzureRmSubscription -SubscriptionName "your subsciption name" | Select-AzureRmSubscription

Select subscription ASM

Select-AzureSubscription "MySubscription"

The best approach is to identify subscription base on subscription id and not subscription name. If you will have few subscriptions there is a possibility that names for some of them will be duplicated. By accident you can do the mess especially if you’ve got production subscription linked to your account. Subscription Id is unique identifier and you can be sure that you select correct one.

Once you will have subscription selected you can start with writing your code.
To list all of available Azure cmdlets use command

Get-Command -name *Azure*

To list only commands available for ARM use below

Get-Command -name *AzureRM*

Generally that’s everything what you need to start your journey with Powershell and Azure.
Now you can use all commands which are available in both Azure ARM and Azure ASM deployment models.
In next articles I will try to show you how to automate basic cloud tasks with Powershell.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.