Over a million developers have joined DZone.
Platinum Partner

One-Click Azure VM Deployment with PowerShell User Experience

· Cloud Zone

The Cloud Zone is brought to you in partnership with Iron.io. Discover how Microservices have transformed the way developers are building and deploying applications in the era of modern cloud infrastructure.

I somehow get into writing PowerShell script in the last few days for facilitating deploying Windows Azure VMs into configured subnets for our upcoming Windows Azure IaaS Training Days. (Here’s the shameless plug.)

First I got started with Windows Azure PowerShell cmdlet and set up Windows Azure PowerShell. Then… this world is never the same anymore. I … see the light. Anyway, so this allows me to run PowerShell within a Windows Azure subscription account. It’s almost like having Microsoft datacenters in my living room, I can stop by and check it out anytime. Just open up my PowerShell ISE and there you are, play as hard as you want. So I wrote some script and ended up what I am showing here.

I packaged a few cmdlets together into function calls such that I can deploy a VM, and add it into a load balancer, and an availability set by arranging the calls like the following:

- See more at: http://blogs.technet.com/b/yungchou/archive/2013/05/09/one-click-windows-azure-vm-iaas-deployment-with-powershell-user-experience.aspx#sthash.tv6FCAjE.dpuf


So the above code will deploy the first VM, fe1, to a target service followed by deploying two more VMs, fe2 and fe3, and load balance the three and put the three into an availability set.

My bag packed, last night pre-flight…

And here’s an infrastructure I have set up in Windows Azure, this needs to be configured first, so employed Windows Azure DNS, an Affinity Group, storage account, and a virtual network with target subnets are all in place first. What I have set up are the following:





Then after about 2 consecutive sleepless nights and a lot of coffee, finally

Zero hour, 9 AM

Well actually it was 12:54 PM, I cleared my throat and said, “Ground control, this is Major Tom, over…” and here’s what happened:


… then lunch, email, more email… then about 20 minutes later, the job ended quietly


and examined the session history, here’s how it went:





and in my Windows Azure subscription, now there are eight VMs deployed into three subnets.

Ground Control, I’m back.


The three VMs deployed to the frontend subnet were load-balanced and placed in an availability set. Two SharePoint boxes were in an availability set and deployed to the midtier subnet. And the two VMs, dc1 and dc2 in an availability set, and a SQL Server 2012 were deployed to the backend subnet.


And a number of data disks were also attached to intended VMs accordingly:


The virtual network now looked like this after the deployment:


On such a timeless flight

So never will I deploy a VM to Windows Azure without PowerShell again. The end.


And just stay tuned I will publish the script in a few days.

- See more at: http://blogs.technet.com/b/yungchou/archive/2013/05/09/one-click-windows-azure-vm-iaas-deployment-with-powershell-user-experience.aspx#sthash.USzCvOho.dpuf

The Cloud Zone is brought to you in partnership with Iron.io. Learn how to build and test their Go programs inside Docker containers.


Published at DZone with permission of Yung Chou , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}