Azure / Azure/azure-cli

az vm run-command is not working with script files as stated

Open
#17,912 2 comments 0 reactions 1 assignee Claimed by @qwordy View on GitHub
act-observability-squad Compute feature-request question
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

The az vm run-command is not working with script files as stated in this page. Nor are they working from a yml pipeline (AzDo) in the same manner as from the commandline.

From the commandline, to be able to use a script, you sometimes need to put single quotes around the script name (not alway, which seems inconsistent. Using this command with a deployment pipeline to run certain scripts at once (dcs is too slow), you need to put quotes around the scriptname, because it will report an error if you don't. And when you do, the pipeline complains the following: "\nThe splatting operator '@' cannot be used to reference variables in an expression." And if that isn't happening, then a powershell script is created with quotes around the scriptname, instead of the script.
And lastely, the command does strange things when you use more than 2 parameters.
Unfortunately the Powershell cmdlet is having it's own quircks, although moslty similar results as with az.

We are running Az CLI 2.22.0.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: f04b196d-7d11-7213-f037-f12b85b19c52
* Version Independent ID: adc05d8e-b13b-134b-5f61-42aaf23666df
* Content: [az vm run-command](https://docs.microsoft.com/en-us/cli/azure/vm/run-command?view=azure-cli-latest#az_vm_run_command_invoke)
* Content Source: [latest/docs-ref-autogen/vm/run-command.yml](https://github.com/MicrosoftDocs/azure-docs-cli/blob/master/latest/docs-ref-autogen/vm/run-command.yml)
* Service: **virtual-machines**
* GitHub Login: @rloutlaw
* Microsoft Alias: **routlaw**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.