Azure recently launched the 1.0 version of PowerShell cmdlets. The changes are huge, including new Azure Resource Manager (ARM), which resulted in deprecating Azure-SwitchMode between ASM and ARM. In this post, we only have a brief look at how new PowerShell cmdlets for ARM have been introduced, especially for managing resource groups and templates.

Installation

In order to get the newest Azure PowerShell, using MS Web Platform Installer is the quickest and easiest way.

Note: At the moment of writing, the released date of Azure PowerShell is Nov. 9th, 2015.

Of course, there are other ways to install the latest version of Azure PowerShell, but this is beyond the scope of this post.

New Set of Cmdlets

Now, the new version of Azure PowerShell has been installed. Run PowerShell ISE with an Administrator privilege. As always, run Update-Help to get the all help files up-to-date. Then try the following command:

If you can’t see anything, don’t worry. You can restart ISE or even restart your PC to get it working. Alternatively, you can check those cmdlets through ISE like:

Can you find any differences comparing to the previous version of cmdlets? All cmdlets are named as patterns of [action]-AzureRm[noun]. For example, in order to get the list of resource groups, you can run Get-AzureRmResourceGroup. The result will look like:

Now, let’s try to set up a simple web application infrastructure. For the web application, at least one website and database is required. In addition to them, for telemetry purpose, ApplicationInsights might be necessary.

Create a Resource Group

For those infrastructure, we need a resource group. Try the following cmdlets in that order:

Can you find out the differences from the old cmdlets?

Old Cmdlets New Cmdlets
Get-AzureAccount Login-AzureRmAccount
Get-AzureSubscription Get-AzureRmSubscription
Select-AzureSubscription Select-AzureRmSubscription

As stated above, all cmdlets now have names of AzureRm instead of Azure. Once you complete choosing your subscription, if you have more than one subscription, it’s time to create a resource group for those infrastructure items. It might be worth having a look naming guidelines for Azure resources. Let’s try it.

Old Cmdlets New Cmdlets
New-AzureResourceGroup New-AzureRmResourceGroup

Therefore, enter the following to create a resource group:

The resource group is now named as ase-dev-rg-sample and created in the Australia Southeast (Melbourne) region. Let’s move onto the next step, setting up all resources using a template.

Setup Resources with Azure Resource Template

Fortunately, there is a template for our purpose on GitHub repository: https://github.com/Azure/azure-quickstart-templates/tree/master/201-web-app-sql-database.

Old Cmdlets New Cmdlets
New-AzureResourceGroupDeployment New-AzureRmResourceGroupDeployment

Use the new cmdlet and add all resources into the group:

As you can see, we set the template file directly from GitHub and left parameter source. Therefore, it will ask to type necessary parameters:

Once everything is entered, as I put -Verbose parameter, all setup details will be displayed as well as result:

Check out the Azure Portal whether all defined resources have been deployed or not.

Everything has been smoothly deployed.

We have so far had a quick look of ARM with resource group management using new version of PowerShell cmdlets. There are more cmdlets in Azure PowerShell to control individual resources more precisely. I’m not going to deep dive too much here, but it’s much worth trying other cmdlets for your infrastructure setup purpose. They are even more powerful than before.

Keep enjoying on cloud with Kloud!

Category:
Azure Infrastructure, Azure Platform, PowerShell
Tags:
, , , ,

Join the conversation! 5 Comments

  1. Thanks a lot, Jutin! This is the first web site discussing around the concepts of ARM PoweShell based deployments in a simple manner.

Comments are closed.