Did you know you can actually deploy an entire server farm in just a bunch of code =)
Just by using Powershell!
Powershell for Microsoft Azure was introduced in june 2012 (src), so it has been around for quite some time. Still, I learned from it existence only recently…
And DAMN, you can do awesome things with it!
Some Czech University got me started.
The article can be found over here: http://ulita.ms.mff.cuni.cz/pub/predn/NSWI152/azure/watk/Labs%5CDeployingActiveDirectoryPS%5CHOL.htm
First, of course, download the Azure Powershell pack!
This pack contains the Azure Module for Powershell, and provides a whole bunch of CMDlet’s: http://msdn.microsoft.com/en-us/library/jj152841.aspx
Second, you need a subscription file. This file let’s you connect to the Azure environment.
The subscriptionfile is actualy just an XML-file, containing the Management Certificate.
You can connect to azure using this file, or manually load the certificate from azure (yay, 2 options)
You can get this publishsettings-file by running the
Get-AzurePublishSettingsFile Import-AzurePublishSettingsFile C:\users\deswale\Desktop\mendelazure.publishsettings
Run this only once, because each time you run it, you’ll create a new certificate (gets messy in Azure).
So, you’ve imported your publishsettingsfile and you’re connected to Windows Azure.
Next on the todo-list.
The very first time, you have to create a storage account to host all your data (virtual hard disks and stuff).
Next you’ll have to create a virtual network. Yep, you can even define your networks in xml, and upload them to Azure! For example: this one!
And you need an affinity group! (This makes sure your virtual environment is hosted in the same geographical region. You don’t want your cpu’s running in America with your data stored in Asia, do you? 😛 )
So, run some basic command
Get-AzureSubscription Get-AzureStorageAccount New-AzureStorageAccount Get-AzureAffinityGroup New-AzureAffinityGroup get-AzureLocation New-AzureAffinityGroup –Name "MendelGroup1" –Location "North Europe" New-AzureStorageAccount -StorageAccountName "mendelstorage1" -Label "First Storage Group" -AffinityGroup "mendelgroup1" Set-AzureSubscription –SubscriptionName "Gratis evaluatieversie" –CurrentStorageAccount "mendelstorage1" Get-AzureVMImage | select imagename $ConfigPath = "c:\users\mendel\desktop\networkconfig.xml" Set-AzureVNetConfig -ConfigurationPath $ConfigPath New-AzureQuickVM –Windows –ServiceName "MendelService" –Name "THEMachine" –ImageName "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-Preview-201306.01-en.us-127GB.vhd" –Password "AdminPassword123456798" -AdminUsername "mendel" -location "North Europe"
And in the end, you can create something like this: http://blogs.technet.com/b/yungchou/archive/2013/07/31/automating-windows-azure-infrastructure-services-iaas-deployment-with-powershell.aspx – WARNING, can be to awesome to handle…
At the moment we’re writing a script with a nice collection of azure-features.
Will be publicly available later!