- 3 server Azure VM setup for SharePoint 2013
- Shrinking Azure vhd blobs
- Turning a DC into a server core install
In my case I have a Visual Studio Ultimate with MSDN subscription which gives me $150 free spending per month (http://www.windowsazure.com/en-us/offers/ms-azr-0049p), so we’ll see how that looks after a month’s use.
As my starting point I downloaded provisioning scripts from https://github.com/windowsazure/azure-sdk-tools-samples which includes a nice three server setup with Domain Controller, SQL Server and SharePoint. The base images for this farm are pulled out from the Azure VM sample images catalog.
I did some changes to the scripts to suit me better and to save on hardware regarding the VM’s.
- DC = ExtraSmall (Original Small)
- SQL = Large (Original A6)
- SharePoint = Large
My main beef with the sample images from Azure is that they use 130gb for the OS disk while the previous versions used 30gb. By shaving off 3x100gb the savings will be around $30/month. Not that big a deal perhaps, but for that kind of money I can buy two, yes you read it, TWO pints of beer in Oslo :D That’s a potential 24 more beers per year. Not to be taken lightly.
Once you have your Azure subscription set up and have run the provisioning scripts you will have three VM’s running as seen in the Azure portal.
Next up is logging into each VM and resizing the OS disk down to 30gb using Disk Manager.
Basically you shrink the OS disk with 97,281MB, down to 32765MB, this fits the size of 32GB used in the script below.
After reducing the size of the OS disk in all three VM’s, shut them down. Next up is shrinking the physical vhd files in blob storage. This is done using an excellent vhd resizing tool by Maarten Balliauw. You can get the tool and source code at https://github.com/maartenba/WindowsAzureDiskResizer, and read Maarten’s post on it at http://blog.maartenballiauw.be/post/2013/01/07/Tales-from-the-trenches-resizing-a-Windows-Azure-virtual-disk-the-smooth-way.aspx
Be sure to download and compile the code yourself, as the linked binaries does not support shrinking (or get a compiled version (2013-06-26) from my Dropbox).
Run the below commands in an elevated Azure PowerShell window for the actual shrinking. What happens is that each VM’s config is exported, the VM is deleted, and the VM disk is deleted. This ensures there is no lease on the vhd blob in blob storage.
Next the resize command is executed, and the VM’s are re-provisioned using the vhd’s and saved config files.
# Azure cloud service name used in original provisioning $serviceName = "mycloudservice" # Azure blob storage used for the vhd's $storageName = "mystorage" # Key used to access blob storage # Key can be retrieved from https://manage.windowsazure.com/?whr=live.com#Workspaces/StorageExtension/storage # and hitting the Manage Access Key's button $storageKey = "your key here" # New OS disk size, matching 32765MB $newSizeGB = 32 # DC1 Export-AzureVM -ServiceName $serviceName -Name DC1 -Path D:\Azure\dc1.xml Remove-AzureVM -ServiceName $serviceName -Name DC1 $disk = Get-AzureDisk | where {$_.DiskName -match $storageName -and $_.DiskName -match "DC1" -and $_.OS -eq "Windows"} $vhdLink = $disk.MediaLink $disk | Remove-AzureDisk .\WindowsAzureDiskResizer $newSizeGB $vhdLink $storageName $storageKey Add-AzureDisk -DiskName $disk.DiskName -MediaLocation $vhdLink -OS $disk.OS Import-AzureVM -Path D:\Azure\dc1.xml | New-AzureVM -ServiceName $serviceName #SQL1 Export-AzureVM -ServiceName $serviceName -Name SQL1 -Path D:\Azure\sql1.xml Remove-AzureVM -ServiceName $serviceName -Name SQL1 $disk = Get-AzureDisk | where {$_.DiskName -match $storageName -and $_.DiskName -match "SQL1" -and $_.OS -eq "Windows"} $vhdLink = $disk.MediaLink $disk | Remove-AzureDisk .\WindowsAzureDiskResizer $newSizeGB $vhdLink $storageName $storageKey Add-AzureDisk -DiskName $disk.DiskName -MediaLocation $vhdLink -OS $disk.OS Import-AzureVM -Path D:\Azure\sql1.xml | New-AzureVM -ServiceName $serviceName #SPAllInOne Export-AzureVM -ServiceName $serviceName -Name SPAllInOne -Path D:\Azure\sp1.xml Remove-AzureVM -ServiceName $serviceName -Name SPAllInOne $disk = Get-AzureDisk | where {$_.DiskName -match $storageName -and $_.DiskName -match "SPAllInOne" -and $_.OS -eq "Windows"} $vhdLink = $disk.MediaLink $disk | Remove-AzureDisk .\WindowsAzureDiskResizer $newSizeGB $vhdLink $storageName $storageKey Add-AzureDisk -DiskName $disk.DiskName -MediaLocation $vhdLink -OS $disk.OS Import-AzureVM -Path D:\Azure\sp1.xml | New-AzureVM -ServiceName $serviceName
Once the disks have been fixed you can restart the VM’s either from the Azure portal or via PowerShell.
I mentioned at the top that I wanted the DC to be a Core install. This is done by logging into the DC1 server, opening an elevated command prompt window and run the command below:
c:\>Dism /online /disable-feature /featurename:ServerCore-FullServer
More Info: http://virtualisationandmanagement.wordpress.com/2012/08/09/windows-2012-converting-a-full-gui-version-to-server-core-and-vice-versa/.
By turning the DC into a Core install you have to use one of the other servers for managing your users and DNS. This is accomplished by installing Remote Management Tool on one of the other servers. I decided to use my SQL box.
Now you’re ready to rock and roll with your new dev environment. Time will tell if I have enough RAM on the SP box for doing development, if not I’ll just re-provision it with more.
My next steps will be to add one more server for Office Web Apps (or put it on the SQL box), and install Visual Studio 2010 on the SP box.