Getting started with the Azure management PowerShell cmdlets

Posted: (EET/GMT+2)

 

PowerShell is a convenient way to manage Azure resources from the command line. Once you install the Azure modules to your computer, you can create manage individual resource and resource groups, deploy VMs, or manage storage directly from a script, among many other things.

To get started, install the module from the PowerShell Gallery (in Windows PowerShell):

Install-Module AzureRM

Then connect to your subscription:

Login-AzureRmAccount

List your subscriptions and select one:

Get-AzureRmSubscription
Select-AzureRmSubscription -SubscriptionName "My Subscription"

Now you can manage resources. For example, create a resource group or list all groups:

New-AzureRmResourceGroup -Name "TestRG" -Location "West Europe"
Get-AzureRmResourceGroup

From here, you can script more complex tasks like VM creation, storage account management, or role assignments. If you work with Azure regularly, having a few small scripts saves a lot of clicks in the Portal.