Forum Discussion
arshadbadarkhan
Aug 27, 2023Copper Contributor
How to create an Azure VMSS with configs Microsoft Hosted Agent
Based on this article here https://github.com/actions/runner-images/blob/main/README.md I I've successfully created a VHD. But after this i would like to create a VMSS which would be conne...
Kidd_Ip
Aug 17, 2025MVP
Take this:
- Upload Your VHD to Azure Storage
Make sure the VHD is in a standard storage account and is accessible for VM creation.
- Create a Managed Image from the VHD
Use Azure CLI or Portal to create a managed image:
az image create \
--resource-group <your-resource-group> \
--name myRunnerImage \
--os-type Linux|Windows \
--source https://<your-storage-account>.blob.core.windows.net/<container>/<your-vhd>.vhd
- Create VMSS from the Managed Image
az vmss create \
--resource-group <your-resource-group> \
--name myRunnerVMSS \
--image myRunnerImage \
--upgrade-policy-mode automatic \
--admin-username azureuser \
--generate-ssh-keys \
--instance-count 2 \
--vm-sku Standard_DS2_v2
Make sure to configure networking, scaling, and diagnostics as needed.
- Install Azure Pipelines Agent on Startup
Use a custom script extension or cloud-init to install and configure the Azure Pipelines agent on each VM instance:
#!/bin/bash
mkdir myagent && cd myagent
curl -O https://vstsagentpackage.azureedge.net/agent/3.225.0/vsts-agent-linux-x64-3.225.0.tar.gz
tar zxvf vsts-agent-linux-x64-3.225.0.tar.gz
./config.sh --unattended --url https://dev.azure.com/<your-org> \
--auth pat --token <your-PAT> --pool <your-agent-pool> --acceptTeeEula
./svc.sh install
./svc.sh start
For Windows, use PowerShell and the corresponding agent package.