With recent announcements like Managed Disks and Images, I thought it would be cool to put a script together. It will provision a VM Scaleset using a custom image that is captured from an existing server with existing applications and add autoscaling to it!
The general steps are to
- take a copy of the existing virtual machine. I use Azure Storage Explorer as my favourite tool.
- run sysprep and generalise it. "Sysprep /generalize /shutdown /oobe"
- run the powershell to set it generalise.
Set-AzureRmVm -ResourceGroupName $rgName -Name $vm.Name Generalized
- In Azure Portal, Images, create a new image pointing it to the generalised VM.
- in Azure Portal, Templates (Preview), add the attached custom deployment template and deploy it
Once the VM Scaleset is provisioned, you can see the Overview for the autoscaling information.
RDP into the VM using the public IP address shown but set the port to 50000.
Then download a CPU Stress tool and run it. After a few minutes, autoscaling will provision more instances.
This is a POC script so feel free to modify it.
Let me know if you have any questions.