我在Windows 10專業版PowerShell腳本中運行Azure CLI命令,收到了這樣的錯誤:
我在Windows 10專業版PowerShell腳本中運行Azure CLI命令。
(conflict) Run command OS type 'Windows does not match the target OS Linux.
PowerShell版本:
Major Minor Build Revision
----- ----- --------
5 1 19041 1237
失敗的PowerShell腳本:
$ResourceGroup= "Development"
$VmName = "ubuntu-test"
az vm run-command invoke `.
--資源組 $ResourceGroup `
--name $VmName `` --command-id RunPowerSchool `
--command-id RunPowerShellScript `
--scripts "ufw disable"
注意:`字符是回車鍵。在同一個鍵上的那個傾斜符號~
同樣的命令,如果沒有續行的回車符,也可以作業:
az vm run-command invoke --resource-group Development --name ubuntu-test --command-id RunShellScript --scripts "ufw disable"/span>
如果我做一個Write-Host,輸出是一個單行的正確引數,減去--script命令周圍的引號。
Write-Host az vm run-command invoke `。
--resource-group $ResourceGroup `。
--name $VmName `
--command-id RunPowerShellScript `
--scripts "ufw disable"
az vm run-command invoke --resource-group Development --name ubuntu-test --command-id RunPowerShellScript --scripts ufw disable
AZ CLI呼叫命令的檔案中沒有提到關于設定作業系統型別的內容。
uj5u.com熱心網友回復:
我認為使用行延續(`在行的最后)是偶然的問題。
除了使用變數和字面意義之外,你的多行命令和你的單行命令之間的關鍵區別是:
--command-id RunPowerShellScript vs. --command-id RunShellScript。
看起來你的目標虛擬機是一臺Linux機器,并且--command-id RunPowerShellScript在那里不被支持,而--command-id RunShellScript被支持。
az vm run-command list ...顯然可以用來發現支持的 --command-id 值。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/326099.html
標籤:
上一篇:Azure應用服務:應用程式依賴清單中指定的程式集(Microsoft.AspNetCore.AzureAppServices.HostingStartup.deps.json)未找到。
