-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Managed Run Command paramters are missing when run as a user #27767
Copy link
Copy link
Open
Labels
Auto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamComputeaz vm/vmss/image/disk/snapshotaz vm/vmss/image/disk/snapshotact-observability-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.potential-pruningquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone
Metadata
Metadata
Assignees
Labels
Auto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamComputeaz vm/vmss/image/disk/snapshotaz vm/vmss/image/disk/snapshotact-observability-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.potential-pruningquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Describe the bug
Managed Run Command parameters only work when the script is run as the root user on Linux.
--parametersand--protected-parametersare not respected when the--run-as-userCLI parameter is also present.Related command
az vm run-command create \ --resource-group <group> \ --location <region> \ --vm-name <vm> \ --name <name> \ --script 'echo $FOO $BAR' \ --run-as-user <user> \ --parameters FOO=foo \ --protected-parameters BAR=barErrors
The above command properly prints
foo barwhen run without--run-as-user, but prints a blank line when run with--run-as-userIssue script & Debug output
I can provide full debug output if needed, but I can see from the response that the variables are being passed properly. The issue seems to be with how the target VM processes the request.
{ "asyncExecution": false, "errorBlobUri": null, "id": "/subscriptions/<subscription>/resourceGroups/<group>/providers/Microsoft.Compute/virtualMachines/<vm>/runCommands/<name>", "instanceView": null, "location": "<region>", "name": "<name>", "outputBlobUri": null, "parameters": [ { "name": "FOO", "value": "foo" } ], "protectedParameters": null, "provisioningState": "Succeeded", "resourceGroup": "<group>", "runAsPassword": null, "runAsUser":"<user>", "source": { "commandId": null, "script": "echo $FOO $BAR", "scriptUri": null }, "tags": null, "timeoutInSeconds": 0, "type": "Microsoft.Compute/virtualMachines/runCommands" }Expected behavior
--parametersand--protected-parametersshould still work when--run-as-useris present.Environment Summary
Additional context
No response