Cloud Zone is brought to you in partnership with:

Yung Chou is currently a Technology Evangelist in Microsoft US Developer and Platform Evangelism team. Within the company, he has had opportunities serving customers in the areas of support account ma Yung is a DZone MVB and is not an employee of DZone and has posted 23 posts at DZone. You can read more from them at their website. View Full User Profile

One-Click Azure VM Deployment with PowerShell User Experience

05.10.2013
| 1649 views |
  • submit to reddit

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

image

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:

image

image

image

image

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:

image

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

image

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

image

image

image

image

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

Ground Control, I’m back.

image

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.

SNAGHTML122cfc2

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

image

The virtual network now looked like this after the deployment:

image

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





Published at DZone with permission of Yung Chou, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)