Question:
Following this example here https://learn.microsoft.com/en-us/cli/azure/vm/run-command?view=azure-cli-latest
I’m getting an error when running my command
1 2 |
az vm run-command invoke --command-id RunPowerShellScript --name win-vm -g my-resource-group --scripts @script.ps1 |
Error:
The splatting operator ‘@’ cannot be used to reference variables in an expression. ‘@script’ can be used only as an argument to a command. To reference variables in an expression use ‘$script’.
Putting it in quotes only passes in the contents in the quotes, not the contents of the script.
Answer:
if you install package whit @ you should install package whit CMD