【发布时间】:2021-09-28 17:39:09
【问题描述】:
我正在尝试部署 VM 并使用 ARM 模板运行扩展 powershell 脚本。 下面的脚本负责运行 VM 的扩展。 从部分可以看出:
"commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -File arm-modules/../../install.ps1 '
powershell 将从该位置执行脚本文件。我想将 .ps1 文件保存在 git 存储库中,并将链接传递给文件而不是本地文件夹。
类似"commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -Uri https://raw.githubusercontent.com/.../install.ps1
我怎样才能做到这一点?
"resources": [
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('virtualMachineName'), '/' ,parameters('virtualMachineName'), 'installGW')]",
"apiVersion": "2019-07-01",
"location": "[parameters('location')]",
"tags": {
"vmname": "[parameters('virtualMachineName')]"
},
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.7",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"[parameters('scriptURL')]"
]
},
"protectedSettings": {
"commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -File arm-modules/.../.../install.ps1 ', if(equals(parameters('existingDataFactoryVersion'), 'V2'), listAuthKeys(parameters('irId'), '2017-09-01-preview').authKey1, listAuthKeys(parameters('irId'), '2015-10-01').key1))]"
}
}
}
]
【问题讨论】:
标签: azure powershell azure-devops azure-resource-manager