An Azure service that is used to provision Windows and Linux virtual machines.
Yes. Azure supports end-to-end automation and management of scalable VM-based infrastructure solutions, with different tools depending on the goal:
- Infrastructure deployment at scale
- Terraform: define network, storage, and VM resources in HCL and reuse templates across environments.
- Azure Resource Manager templates and Bicep: declaratively deploy Azure resources in a consistent, repeatable way.
- VM configuration automation
- cloud-init for Linux VMs: customize the VM on first boot to install packages, write files, and configure users and security.
- Custom Script Extension and PowerShell DSC: automate post-deployment configuration.
- Custom image creation for scale
- Packer: automate creation of custom VM images, including OS definition and post-configuration scripts, then capture the result as a managed disk image.
- For Azure Lab Services custom images from Azure VMs, prepare the VM, install software, and keep the disk size at 128 GB or less.
- Application deployment and delivery
- Azure DevOps Services and Jenkins can automate deployment pipelines on top of the VM infrastructure.
Azure Portal path
- Create or prepare an Azure VM.
- Install required software and configuration.
- For reusable images, export or capture the VM as a custom image.
- Use that image for repeatable deployments.
- For declarative infrastructure, use Bicep, ARM templates, or Terraform for repeated environment creation.
Azure CLI example for lab VM creation
- Set the subscription context:
az account set --subscription 11111111-1111-1111-1111-111111111111
- Create a VM from a marketplace image:
az lab vm create --resource-group DtlResourceGroup --lab-name MyLab --name 'MyTestVm' --image "Visual Studio Community 2017 on Windows Server 2016 (x64)" --image-type gallery --size 'Standard_D2s_v3' --admin-username 'AdminUser' --admin-password 'Password1!'
- Create a VM from a custom image:
az lab vm create --resource-group DtlResourceGroup --lab-name MyLab --name 'MyTestVm' --image "My Custom Image" --image-type custom --size 'Standard_D2s_v3' --admin-username 'AdminUser' --admin-password 'Password1!'
- Create a Linux VM with SSH authentication:
az lab vm create --lab-name sampleLabName --resource-group sampleLabResourceGroup --name sampleVMName --image "Ubuntu Server 16.04 LTS" --image-type gallery --size Standard_DS1_v2 --authentication-type ssh --generate-ssh-keys --ip-configuration public
Recommended approach by scenario
- Use Terraform, ARM, or Bicep for scalable infrastructure provisioning.
- Use cloud-init for Linux first-boot configuration.
- Use Packer when standardized custom VM images are needed.
- Use Azure DevOps or Jenkins for deployment pipelines.
References:
- Use infrastructure automation tools with virtual machines in Azure
- Create and manage virtual machines with DevTest Labs using the Azure CLI
- Create a lab in Azure Lab Services from a Windows-based Azure virtual machine
- Bring a Linux custom image from an Azure virtual machine
- What is Azure Lab Services?