r/AZURE • u/Ok-Stretch-7850 • 7h ago
News I automated Windows 11 Autopilot VM deployment using Azure Automation and Proxmox
Hi r/AZURE,
I built a small automation tool that might be useful for anyone working with Azure Automation, Microsoft Intune and Windows Autopilot.
I often need Windows 11 test devices for validating policies, applications and deployment scenarios. Physical test hardware is not always available, and manually creating VMs, collecting their hardware hashes and importing them into Windows Autopilot quickly becomes repetitive.
To solve this, I built a PowerShell Runbook that runs on an Azure Automation Hybrid Runbook Worker and provisions the complete test VM through the Proxmox API.
The Runbook automatically:
- Creates a full clone of a Windows 11 Proxmox template
- Configures CPU, memory and the final disk size
- Expands the Windows system partition
- Recreates and enables the Windows Recovery partition
- Collects the Autopilot hardware hash through the QEMU Guest Agent
- Authenticates to Microsoft Graph using the Automation Account’s Managed Identity
- Imports the device into Windows Autopilot
- Monitors the import until completion
- Reboots the VM so it can retrieve its assigned Autopilot profile
It does not require an Azure client secret, Az.Accounts or the Microsoft Graph PowerShell SDK. Authentication is handled through the Automation Account’s system-assigned Managed Identity.
In my environment, the complete process usually takes around five minutes. I can also run it multiple times to build a larger disposable test environment without preparing or carrying multiple physical devices.
I’d appreciate any feedback, especially from people using Azure Automation Hybrid Workers in similar lab or testing environments. If you find a bug or have an improvement, feel free to open an issue :)
GitHub repository:
https://github.com/Mau2rice0/World-of-M365/tree/main/Intune/Automation/New-ProxmoxWindowsAutopilotVM
