根据要求在 Azure 上自动安装
Automate installation on Azure on request
有没有办法通过 API 调用或挂钩来触发 Azure VM 中的安装程序以获取安装程序 运行?类似于可以远程执行的 PowerShell,我只需要向它传递一个参数,它将传递给安装程序。
我需要一些简单快速的东西,
我已经调查了 Custom Script Extension
,但我不知道如何触发它。不确定应该搜索什么。
您可以使用 Invoke-AzVmRunCommand 来执行此操作。该脚本需要位于 cmdlet 所在的本地 运行.
Invoke-AzVMRunCommand -ResourceGroupName 'rgname' -VMName 'vmname' -CommandId 'RunPowerShellScript' -ScriptPath 'sample.ps1' -Parameter @{param1 = "var1"; param2 = "var2"}
有几个选项可用于 VM 中的 运行 命令。
虽然 Custom Script Extension is useful for configuration or management tasks, the Run command feature is very useful in that it is available even when the machine is not reachable. You can also run a Hybrid Runbook Worker 您的自定义脚本存储在自动化帐户中。
有关详细信息,请参阅以下文档:
有没有办法通过 API 调用或挂钩来触发 Azure VM 中的安装程序以获取安装程序 运行?类似于可以远程执行的 PowerShell,我只需要向它传递一个参数,它将传递给安装程序。
我需要一些简单快速的东西,
我已经调查了 Custom Script Extension
,但我不知道如何触发它。不确定应该搜索什么。
您可以使用 Invoke-AzVmRunCommand 来执行此操作。该脚本需要位于 cmdlet 所在的本地 运行.
Invoke-AzVMRunCommand -ResourceGroupName 'rgname' -VMName 'vmname' -CommandId 'RunPowerShellScript' -ScriptPath 'sample.ps1' -Parameter @{param1 = "var1"; param2 = "var2"}
有几个选项可用于 VM 中的 运行 命令。
虽然 Custom Script Extension is useful for configuration or management tasks, the Run command feature is very useful in that it is available even when the machine is not reachable. You can also run a Hybrid Runbook Worker 您的自定义脚本存储在自动化帐户中。
有关详细信息,请参阅以下文档: