将“az vm run-command"与 .ps1 文件一起使用 [英] Using the 'az vm run-command' with a .ps1 file
本文介绍了将“az vm run-command"与 .ps1 文件一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对 az vm run-command
有问题.
我已将其内联工作如下:
I have got it working inline as follows:
$resource_name="winsecagentdev2"
$resource_group="russellmccloydev"
和:
az vm run-command invoke `
-g "${resource_group}" `
-n "${resource_name}" `
--command-id 'RunPowerShellScript' `
--scripts "Write-Output 'testing russ'"
它有效.
但是当我尝试使用 .ps1 文件时:
But when I try to use a .ps1 file:
az vm run-command invoke `
-g "${resource_group}" `
-n "${resource_name}" `
--command-id 'RunPowerShellScript' `
--scripts @{'hello.ps1'} `
--parameters @{ "test" = "russell" }
我遇到了这个问题:
文档是这样说的:
所以我有点卡住了.
推荐答案
您需要将文件放入您的 VM 并使用以下格式:
You need to put the file in your VM and use the format below:
--scripts "C:\test\hello.ps1"
结果:
这篇关于将“az vm run-command"与 .ps1 文件一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文