如何在Python中使用包含多个参数的PowerShell脚本文件运行Azure CLI运行命令调用?

如何在Python中使用包含多个参数的PowerShell脚本文件运行Azure CLI运行命令调用?,python,azure-cli,Python,Azure Cli,我只使用了一个参数就成功地运行了我的脚本,它可以正常工作: 来自子流程导入调用 call(["az", "vm", "run-command", "invoke", "--command-id", "RunPowerShellScript", "-n", "NONPROD-AA-1", "-g", "NONP

我只使用了一个参数就成功地运行了我的脚本,它可以正常工作:

来自子流程导入调用

call(["az", "vm", "run-command", "invoke", "--command-id", "RunPowerShellScript", "-n", "NONPROD-AA-1", "-g", "NONPROD_APP_RG", "--scripts", "@test.ps1", "--parameters", "pattern=test"])
但当我尝试发送两个参数时,失败了: 我试过很多这样的方法:

call(["az", "vm", "run-command", "invoke", "--command-id", "RunPowerShellScript", "-n", "NONPROD-AA-0", "-g", "NONPROD_APP_RG", "--scripts", "@test.ps1", "--parameters", "pattern=test pattern2=test2"])
所有这些都失败了

有什么想法吗

谢谢

更新:

我成功地发送了多个参数,如下所示:

call(["az", "vm", "run-command", "invoke", "--command-id", "RunPowerShellScript", "-n", "NONPROD-AA-0", "-g", "NONPROD_APP_RG", "--scripts", "@test.ps1", "--parameters", "pattern=test" "test2"])

“…--参数”,“模式=测试”“测试2”])


我只需要指定第一个参数名及其值,然后指定其余的参数值而不指定其名称。这很奇怪,但很有效。

您能告诉我错误吗?此外,您能告诉我您是否可以在Azure Clound ShellI中运行命令更新主帖子。现在,我在将路径作为参数传递时遇到了另一个问题:txt=“pathFile=“+R”G:\Accela\av.web\conf\av\serverConfig.properties”=pathFile=G:\Accela\av.web\conf\av\serverConfig.properties。如果我将参数作为“pathFile=“+R”G:\Accela\av.web\conf\av\serverConfig.properties”传递,它将转换为“G:\\Accela\\av.web\\conf\\av\\serverConfig.properties”。
call(["az", "vm", "run-command", "invoke", "--command-id", "RunPowerShellScript", "-n", "NONPROD-BIZ-0", "-g", "NONPROD_APP_RG", "--scripts", "@test.ps1", "--parameters", "@(pattern=test,pattern2=test2"])
call(["az", "vm", "run-command", "invoke", "--command-id", "RunPowerShellScript", "-n", "NONPROD-AA-0", "-g", "NONPROD_APP_RG", "--scripts", "@test.ps1", "--parameters", "pattern=test" "test2"])