Virtual Machine run command script runs intermittently on azure virtual machines.

Chaitrali Deshmukh 41 Reputation points
2022-08-26T21:04:31.247+00:00

Hi,

I am running virtual machine run command by passing following payload to the VM having scriptUri as a custom script that I want to run on the vm.

{
"location": "westus2",
"properties": {
"source": {
"scriptUri": "https://dchaitrali.devframe.cp.horizon.vmware.com/admin/v2/edge-deployments/runCommandScript"
},
"protectedParameters": [
{
"name": "edgeDeploymentId",
"value": ""
},
{
"name": "logId",
"value": "
"
},
{
"name": "orgId",
"value": ""
},
{
"name": "writeSasToken",
"value": "
"
}
],
"asyncExecution": true,
"timeoutInSeconds": 3600
}
}

I have observed that it creates a script and runs on the vm "vmw-hcs-62e07025cacba6014d7e03c7-edge-vm" which is an old vm under this path:
/var/lib/waagent/run-command-handler/download/

while it creates an empty script on a newly deployed vm "vmw-hcs-6309055d2947a0432cbf3f22-edge-vm"
/var/lib/waagent/run-command-handler/download/edge_deployment_logs_6309055d2947a0432cbf3f22_63090ca762e70e1b4e8d16c2/

Not sure how to debug this further, Could you please help in analysing the issue?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,076 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. kobulloc-MSFT 23,181 Reputation points Microsoft Employee
    2022-08-31T01:46:23.7+00:00

    Hello, @Chaitrali Deshmukh !

    It looks like you are using a managed run command via REST API but please correct me if I'm wrong.

    How do I troubleshoot Managed Run Commands using the REST API on my virtual machine?
    Managed Run Command is in public preview so there are still updates required for the final release. It is not currently recommended for production workloads and some features may not be supported or may have constrained capabilities. Having said that, look through these troubleshooting steps:

    • Check your PUT request: Your PUT request should be in the following format and includes subscriptionId, resourceGroupName, vmName, and runCommandName. Make sure these values are all correct: PUT /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/virtualMachines/<vmName>/runcommands/<runCommandName>?api-version=2019-12-01
    • Only one type of source input is allowed: You can choose one of the following for your command: inline script, script URI, or built-in script command ID.
    • Output errors to Storage blobs: Use "errorBlobUri": "<URI>" to output your errors to Storage blobs for troubleshooting.
    • Managed Run Command is in preview: Managed Run Command is in public preview so there are still updates required for the final release. Some features may not be supported or may have constrained capabilities.

    We would need more info to say exactly what is going on but I would doublecheck your PUT request to make sure everything is in order (especially with the old VM under that path) and I would see what kind of errors get output to the Storage blob. If neither of those result in anything, let us know so we can look into issues related to this being in public preview.

    0 comments No comments