Forum Discussion
experi18
Oct 05, 2023Brass Contributor
Azure CLI to join a domain
Hi, wich parameters should I add into my script to create Azure VM (Via CLI) in order to automatically join my domain?
Kidd_Ip
Apr 17, 2024MVP
Expect you are talking about AD DS join:
- Open the Azure CLI command prompt.
- Connect to your Azure account by running the following command:
az login
3. Run the following command to enable PowerShell remoting on the VM:
az vm run-command invoke -g <resource-group-name> -n <vm-name> --command-id enable-psremoting --scripts "yes" --parameters "skipNetworkProfile=false" --output json
- Run the following command to join the VM to the AD DS managed domain:
az vm extension set --resource-group <resource-group-name> --vm-name <vm-name> --name DomainJoin --publisher Microsoft.Compute --version 1.0 --settings '{"name": "<domain-name>","user": "<domain-username>","restart": "true", "options": 3}'
experi18
Apr 17, 2024Brass Contributor
Kidd, I should run this after the VM is created or while its creation?