Trying to join Azure CentOS VM to existing AD Domain. But, it fails. Error message is cryptic and not helpful.
Tried to join Azure CentOS VM to existing AD Domain using JsonADDomainExtension in Terraform. I have tried the following so far,
- Manually, I could join VM to domain using 'realm join'
- Tried TF code without OUPath -> doesn't help
Code is very similar to that of https://github.com/Azure/azure-quickstart-templates/blob/master/201-vm-domain-join-existing/azuredeploy.json
resource "azurerm_virtual_machine_extension" "adjoin" {
name = "${azurerm_virtual_machine.testextn01.name}-adjoin"
location = "${azurerm_resource_group.testextn.location}"
resource_group_name = "${azurerm_resource_group.testextn.name}"
virtual_machine_name = "${azurerm_virtual_machine.testextn01.name}"
publisher = "Microsoft.Compute"
type = "JsonADDomainExtension"
type_handler_version = "1.3"
settings = <<SETTINGS
{
"Name": "NEXT.CLOUD.COM",
"User": "DOMAIN\\ad-join",
"OUPath": "\"OU=Centos,OU=Servers,OU=Operations,DC=NEXT,DC=CLOUD,DC=COM\"",
"Restart": "true",
"Options": "3"
}
SETTINGS
protected_settings = <<PROTECTED_SETTINGS
{
"Password": "topsecret"
}
PROTECTED_SETTINGS
}
Terraform apply was not returning back the prompt,
azurerm_virtual_machine_extension.adjoin: Still creating... (1h26m21s elapsed)
azurerm_virtual_machine_extension.adjoin: Still creating... (1h26m31s elapsed)
azurerm_virtual_machine_extension.adjoin: Still creating... (1h26m41s elapsed)
^CInterrupt received.
Please wait for Terraform to exit or data loss may occur.
Gracefully shutting down...
stopping operation...
Error message reads as below in /var/log/waagent.log file,
2019/07/18 05:06:41.630295 ERROR ExtHandler Event: name=Microsoft.Compute.JsonADDomainExtension, op=Install, message=eJytkcFKxDAURff9ivcBTtK0ndZ2N9gRR3B0PxTJJOkQaPJKkmrHrzdUFBcKMrh8i3s4993Ddg7Keo126xy6DvZoV2/KIahZBxAoVQMsq65AWx/4MBBhZHLwQeIUuiRLWU3TirJrSNdNWjZ5Tco0q6oSdvvbR4j0O27loBxspFQSnnYtsHVRQEAQJ4fTCNSfPe09/TipGCf6ygdtp5mflA1EfRp6+qCFQ499IDdoxikocu/RbtoWDdf2q8ozIznJfpHL86K+WM4og+78T37J8kflXJfQF+7ooI+RvED/SlotJPptmwaimgLWwFHbHzNROG4q0JhYHiwG6HGyMnkHeGWxYg==, duration=0
Error message is clueless and not of much help.