azure-cli: Az VM Run-Command Create run-as details do not work as expected

Related command az vm run-command create

Describe the bug This is a reopen of https://github.com/Azure/azure-cli/issues/21602 that didn’t seem to get resolved. Copying in other people’s feedback into this body, as it is the same as mine!

I’m seeing the exact same issue, and I’ve noted that it is reported for the Azure Powershell library as well (see bottom of linked comment): https://github.com/Azure/azure-powershell/issues/17534#issuecomment-1075509019

Executing the following simple test fails when providing a ‘run-as’ username and password:

az vm run-command create --name “myRunCommand” --vm-name “testvm” --resource-group “TestGroup” --script “Write-Host Hello World!” --run-as-password “" --run-as-user "

The following is the result (truncated) after running az vm run-command show:

{ “executionMessage”: “Script cannot be executed with specified runAsUser/runAsPassword parameters”, “executionState”: “Failed” }

To Reproduce As above. I have tried with AADDS domain user/pwd combo, as well as local username/pwd combo. Neither worked (both on Windows Server 2016 VM, both in local admin user group, with and without log on as batch job rights)

Expected behavior I would expect to provide run-as username/password and for the command to run OK, as long as those users have the appropriate access rights.

Environment summary

Windows 10 21H2 Invoked Az CLI through Powershell 7.2.5 Installed via choco Az version = { “azure-cli”: “2.39.0”, “azure-cli-core”: “2.39.0”, “azure-cli-telemetry”: “1.0.6”, “extensions”: { “aks-preview”: “0.5.87”, “automation”: “0.1.1”, “azure-devops”: “0.25.0”, “connectedk8s”: “1.2.9”, “containerapp”: “0.3.7”, “resource-graph”: “2.1.0” } }

Windows-10-10.0.19044-SP0
Python 3.10.5
Installer: MSI

azure-cli 2.39.0

Extensions:
aks-preview 0.5.87
automation 0.1.1
azure-devops 0.25.0
connectedk8s 1.2.9
containerapp 0.3.7
resource-graph 2.1.0

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (3 by maintainers)

Most upvoted comments

@zhoxing-ms @BCOps , Run As is not working as expected in Production (it is a bug) as of now for Managed Run Command (Preview). We have plans to fix it before we take Run Command to GA. Tentative ETA is 10/31.