簡體   English   中英

在 Azure DevOps 的 azure VM 中運行命令

[英]Running commands in an azure VM from Azure devops

我有以下代碼作為 Azure devops 中的任務,任務完成但記事本沒有在目標虛擬機上運行? 它似乎沒有任何想法?

腳本.ps1

啟動進程notepad.exe

az --% vm run-command invoke --command-id RunPowerShellScript --name vmname -g $ rgname --scripts '@script.ps1'

將“get-process”添加到您的 script.ps1 中,使其現在變為

start-process notepad.exe;get-process

您應該能夠在 get-process 輸出中看到 notepad.exe。 發生這種情況是因為 azure 創建了一個新會話來運行“調用命令”,並且當執行結束時,會話終止。 您登錄的會話是另一個會話。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM