Forum Discussion
wats9416
Oct 30, 2024Copper Contributor
Deploying Azure VM via DevOps pipeline and ARM template -- how to join to the domain?
Hello, I am working on a DevOps pipeline that is able to deploy an Azure VM with an ARM template I've put together. The server is part of a workgroup when created, and I need to add a task to my...
balasubramanim
Oct 31, 2024Iron Contributor
To join an Azure VM to a domain via DevOps.
Add Domain Join in ARM Template -
In the osProfile section of the ARM template, set domainToJoin, domainUsername, and domainPassword.
Use Custom Script Extension -
If domain join can't be added directly, use Custom Script Extension with PowerShell -
Temporarily disable the firewall.
Run Add-Computer to join the domain.
Restart the VM and re-enable the firewall if needed.
Pipeline Task -
In your DevOps pipeline, add an Azure CLI or PowerShell task to execute the Custom Script on the VM.
This approach joins the VM to the domain and manages firewall settings as needed.