Today I finally activated my free trial subscription on Microsoft Azure. This gives me the possibility to play around with all the nice Azure features. After playing around in the GUI I wanted to start looking at the PowerShell commands to manage my Azure subscription with PowerShell locally.
There is a difference between the old and the new PowerShell module, the old module is the “Azure” module with is based on the old portal and Azure Service Manager (ASM) model. The new module “AzureRM” is based on the Azure Resource Manager (ARM) technology. Don’t like old stuff so I use the new AzureRM commands.
Fist we need to Install the Resource Manager module, start PowerShell as Administrator.
1 2 3 4 5 |
#Install the Azure resource manager module locally Install-Module AzureRM #Import the Azure resource manager module Import-AzureRM |
Then login to your subscription with the command.
1 |
Login-AzureRmAccount |
Now you are connected to the Azure Resource manager.
Some sample commands:
1 2 3 4 5 6 7 8 9 10 11 |
#Get azure subscription with PowerShell Get-AzureRMSubscription | ft SubscriptionName, state #Create a resourcegroup New-AzureRmResourceGroup -Name TST001 -Location 'West Europe' #Remove resourcegroup without asking Remove-AzureRmResourceGroup -name TST001 -Force #Get Azure resource manager related commands Get-command *AzureRM* |