azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Odd error when using the JsonADDomainExtension

Open vsadams opened this issue 8 years ago • 8 comments

I am at a loss here. Some times (not all the time) our vms will fail to join the domain The error we get is super odd...

"message": "Handler 'Microsoft.Compute.JsonADDomainExtension' has reported failure for VM Extension 'ADDomainJoin' with terminal error code '1007' and error message: 'Install failed for plugin (name: Microsoft.Compute.JsonADDomainExtension, version 1.3) with exception Value was either too large or too small for an Int32.'"

I have checked the code in this repo and the only thing I think could possibly cause this is the Options. However...in our template that is set to a static 3. I see a few binary shift operations being done, but still nothing that should cause the error above. Any help would be greatly appreciated. The problem seems to be random as it will happen maybe 1/5 vms we deploy using this extensions.

Snippet from our arm here...


{
            "type": "Microsoft.Compute/virtualMachines/extensions",
            "name": "[concat(variables('vmName'), add(copyIndex(), 1),'/ADDomainJoin')]",
            "apiVersion": "2017-03-30",
            "location": "[resourceGroup().location]",
            "copy": {
                "name": "jdLoop",
                "count": "[parameters('vmCount')]"
            },
            "tags": {
                "Purpose": "[concat('Domain Join for ', parameters('stage'), 's ', parameters('appTier'), ' vms')]",
                "Environment": "[parameters('environment')]"
            },
            "properties": {
                "publisher": "Microsoft.Compute",
                "type": "JsonADDomainExtension",
                "typeHandlerVersion": "1.3",
                "autoUpgradeMinorVersion": true,
                "settings": {
                    "Name": "[parameters('domainToJoin')]",
                    "User": "[parameters('domainUsername')]",
                    "Restart": "true",
                    "Options": 3,
                    "OUPath": "[parameters('ouPath')]"
                },
                "protectedSettings": {
                    "Password": "[parameters('domainPassword')]"
                }
            },
            "dependsOn": [
                "[concat(variables('vmName'), add(copyIndex(), 1))]"
            ]
        },

vsadams avatar Mar 13 '18 03:03 vsadams

@vsadams Hey Vincent, would you mind providing the full script that you are running that is failing for you?

cormacpayne avatar Mar 13 '18 17:03 cormacpayne

We are actually deploying our arm template using VSTS. I can give you the full template from our azure arm deployment, if you would like.

vsadams avatar Mar 13 '18 21:03 vsadams

@vsadams just for my understanding, you are not running any Azure PowerShell cmdlets, correct? If you are having issues with the deployment of an ARM template, I would recommend filing an issue in the Azure Quickstart Template repository: https://github.com/Azure/azure-quickstart-templates/issues

cormacpayne avatar Mar 13 '18 21:03 cormacpayne

I would normally file this with the Azure Quickstart however, its the JsonADDomainExtension that is failing specifically, which is in this repo. I can file it in the other repo though, if you think that is a better place for this. I am honestly not sure which repo to post this against.

vsadams avatar Mar 13 '18 23:03 vsadams

@vsadams Were you able to figure this out? I am getting the same error on another DSC extension. If not, did you end up opening a ticket on another repo?

aarsan avatar Mar 22 '18 21:03 aarsan

@aarsan I didnt end up opening this up in another repo. However, I did find a work around.

What I found was that if I created an image from a vm that joined the domain by using that extension. Then created another vm (with that extension) from that image...I would intermittently get the issue. Problem steps 1: Deploy Vm (With extension) 2: Do stuff 3: Remove extension 4: sysprep 5: Create image 6: Create new vm (with extension) from new image [Random extension failures]

However, if my image vm was never joined to the domain, then all vms created from the image would join just fine with the extension.

Hope that makes sense.

I am working through a few other channels to try and find why this is, if i get a resolution, I will post it here.

vsadams avatar Mar 23 '18 20:03 vsadams

I wanted to comment on this as I had a similar issue with the DSC extension. This is for any future viewers benefits. Hopefully it helps.

I had a ticket opened with MSFT support. It seems that this is a known issue. Here are some of the comments from the ticket:

This is caused due to the VM agent version made available to the VM from the host. We have recently made a change on the Guest agent for the way it collects logs. We receive the error “exception Value was either too large or too small for an Int32” when the VM is using the affected version of the agent.

We can address this issue by following the below process. • Copy the WindowsAzureVmAgent.2.7.41491.872_180220-1153.fre.msi to folder c:\VMAgentMSI on the VM that will be sysprep'ed. • Create file named Setupcomplete2.cmd in c:\windows\OEM – with content: msiexec.exe /i c:\VMAgentMSI\WindowsAzureVmAgent.2.7.41491.872_180220-1153.fre.msi /quiet /L*v c:\VMAgentMSI\msiexec.log • Optional: verify that this Setupcomplete2.cmd correctly installs GA – then uninstall & reboot & delete c:\windowsazure\guestagent + registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\GuestAgent to cleanup • Sysprep the VM – OOBE Generalize Shutdown • Capture VM from portal – creates Managed Image called "Myimage-VMAgentMSI" • Deploy VM from image – with ProvisionVMAgent = false.

jugheadny avatar Mar 27 '18 21:03 jugheadny

The ticket we had opened with microsoft ended with the same results as @jugheadny. The steps ended up working for us as well.

vsadams avatar Apr 08 '18 01:04 vsadams