question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
vivlingaiahcommented, Oct 13, 2022

@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.

0reactions
BCOpscommented, Nov 10, 2022

@vivlingaiah - I see that this didn’t get released in the 2.42.0 release on 1st November. Do you have an updated ETA/target release version for this fix to unblock the issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run scripts in a Windows VM in Azure using action Run ...
To function correctly, Run Command requires connectivity (port 443) to Azure public IP addresses. If the extension doesn't have access to these ...
Read more >
Azure Run Command for Dummies - Mandiant
The Azure Run Command feature enables administrators to run commands on Azure Windows or Linux virtual machines by leveraging the virtual ...
Read more >
Azure Virtual Machine Execution Techniques - hausec
Run Command can also be utilized via Az PowerShell, Azure REST API, ... It is imperative as a defender to not simply alert...
Read more >
Azure Bicep Module for Virtual Machine Run Commands
In the past, using ARM templates for VM Run Command might not always be a viable option because you'd have to manually wrap...
Read more >
Bitbucket pipeline to deploy to Azure VM using Azure-cli ...
I finally get it working, you should prefix the file with '@'. I found the solution from there: Using the 'az vm run-command'...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found