When you buy a MSDN subcription with Visual Studio you receive free credits (renewed every month) to use in Windows Azure. This makes it very easy to create your own development and test environment very fast. In my case, as a developer and DBA, I want to create my own virtual machines that I have full control over.
You are able to access most of Azure through PowerShell, and I was particular excited about the possibility to create virtual machines on the fly in PowerShell, and here is the first version of my create_azure_sqlvm.ps1.
create_azure_sqlvm.ps1 "sql06" "sql06admin" "itsaSecret2014"
This script has 3 required parameters: vm-name, admin loginname and password. These parameters must be supplied to script as shown above. In addition, there are 2 default parameters, location and instanceSize. The first default parameters $location is which data center the new virtual machine will be stored. The default value is set to “North Europe” since this is the nearest to my home city Fredrikstad 🙂
All available locations can be retrieved by the following command:
Get-AzureLocation | Select Name
The second default parameter $instanceSize tell Azure how big the virtual machine should be when it is created. The default value for the script is set to “Small”. This value might not be ideal for a production server, but in my case for a development environment, this is okey. Se link for more information on sizes.
The script will install the latest SQL Server 2014 Web edition available. See the ImageFamily parameter to select another image for the SQL Server installation.
When you run the script in administrator mode in PowerShell, you will get some similar out as show below:
According to my calculations this virual machine will cost about $50-70 per month, depending on how much it is used.