Ani*_*Dey 0 azure azure-virtual-machine azure-rest-api
我正在关注此文档并尝试使用它在 vm 中运行一个简单的 shell 脚本。
但是post请求的body需要什么内容就不清楚了。commandID 可以是 RunShellScript 但我们在哪里提供脚本值。
我试过这样的身体
{
commandId: "RunShellScript",
script: "/path/scriptname"
}
Run Code Online (Sandbox Code Playgroud)
有其他选择
script: 'scriptname'
script: 'sh scriptname'
Run Code Online (Sandbox Code Playgroud)
和其他每个导致
{
"error": {
"code": "BadRequest",
"message": "Error converting value "/home/admin1/quick-python-test.sh" to type 'System.Collections.Generic.List`1[System.String]'. Path 'script', line 3, position 52.",
"target": "runCommandInput.script"
}
}
Run Code Online (Sandbox Code Playgroud)
谁能帮助我如何正确地做到这一点?我是 Azure 的新手。
要通过 Azure REST API 在 VM 中运行 bash 脚本,以下是请求的示例正文:
{
"commandId": "RunShellScript",
"script": [
"echo $arg1 $arg2"
],
"parameters": [
{
"name": "arg1",
"value": "hello"
},
{
"name": "arg2",
"value": "world"
}
]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1242 次 |
| 最近记录: |