簡體   English   中英

從外部 VM 在 Azure Win VM 上執行 bat 文件並由 Azure Function 觸發的最佳和最安全的方法是什么

[英]What is the best and securest way to execute bat file on a Azure Win VM from outside VM and triggered by an Azure Function

有一個 Windows 虛擬機托管在 Azure 上。在這個虛擬機上有一個.bat 文件,我需要從外部執行它。 這個過程的開始應該可以在 Azure Function 之內。

有人對此有想法嗎?

我嘗試通過 Azure Cloud Shell 執行 .bat 文件並且它有效,但我發現了多個命令,我不確定哪個是最好的,哪些在 Azure Function 中可用。

最好的祝福

您可以使用 Powershell 作為編程語言編寫 Azure 函數。 然后,導入 Az.Compute 並使用以下命令從 Azure 函數調用虛擬機中的命令:

Invoke-AzVmRunCommand `
     -ResourceGroupName "rg-azpsremote" `
     -VMName "server1" `
     -CommandId "RunPowerShellScript" `
     -ScriptPath "C:\temp\x.ps1"

ps:你可以從ps1文件中調用bat文件。

暫無
暫無

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

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