This month at the PacITPros meeting, I covered several of the ways you can create virtual machines in Azure and get started doing Infrastructure as Code. For a quick summary of the various ways to do this check out this bit of Azure documentation.
If you need to get started with Azure and don’t have a subscription yet, break out your Microsoft Account (aka LiveID, Hotmail account, etc) and pick one of these options:
- Free $200/One Month Trial – $200 credit for use in 30 days.
- Visual Studio Dev Essentials Program – Comes with $25 a month of Azure credit for 12 months.
- IT Pro Cloud Essentials Program – Also comes with $25 a month of Azure credit for 12 months.
Since I dove deeper on doing these deployments with ARM templates and JSON, here are some of the resources you might want to revisit (or check out if you missed the meeting).
- You can find the slide deck and my step-by-step template examples here – http://aka.ms/deconstructingjson
- You can find all my demo templates on GitHub – https://github.com/techbunny/Templates
- You can get started with Azure Quickstart Templates, just remember you always need to check templates often for correct image names and updated data center regions.
- You can check out my whole series of blog posts about JSON templates – https://blog.techbunny.com/tag/json/
- For a great lightweight editor for your templates, check out Visual Studio Code.
Here is an example of the PowerShell command for getting an updated list of images for Windows Server or Ubuntu Server in a particular region:
Get-AzureRmVMImageSku -Location "west us" -PublisherName Microsoftwindowsserver -Offer WindowsServer Get-AzureRmVMImageSku -Location "West US" -PublisherName Canonical -Offer UbuntuServer
Finally, here is my “cheat sheet” of PowerShell commands to connect to your Azure account and deploy a template.
Login-AzureRmAccount Get-AzureRmSubscription $VSSubID = "7ebd5b2e-7d4b-49xe-bab6-4d593ed76x41" # copy the sub-id from the previous command Set-AzureRmContext -SubscriptionID $VSSubID # get the "raw" URL from GitHub for the template you want to deploy and break it up as follows: $assetLocation = "https://raw.githubusercontent.com/techbunny/Templates/master/multiple_nano_server/" $templateFileURI = $assetLocation + "nanoslabdeploy.json" # deployment template $parameterFileURI = $assetLocation + "SVCC.parameters.json" # parameters file $RGName = "PacITPros" # set your resource group name New-AzureRmResourceGroup -Name $RGName -Location "West US" # create your resource group # deploy the template! New-AzureRmResourceGroupDeployment -ResourceGroupName $RGName -TemplateParameterUri $parameterFileURI -TemplateUri $templateFileURI -verbose