首页 > 解决方案 > 如何引用存储在 VSTS 或 Azure DevOps Git Repo 中的链接 ARM 模板?

问题描述

ARM 模板允许您使用“templateLink”属性引用另一个“链接的”ARM 模板。我想在 Azure DevOps (VSTS) 中使用原始 git uri 来执行此操作。我可以用 github 做到这一点,如下所示:

"resources": [ 
  { 
      "apiVersion": "2017-05-10", 
      "name": "linkedTemplate", 
      "type": "Microsoft.Resources/deployments", 
      "properties": { 
        "mode": "incremental", 
        "templateLink": {
          "uri": "https://raw.githubusercontent.com/lw/BaseARMTemplates/master/ARM.json"",
          "contentVersion": "1.0.0.0"
        }, 
      } 
  }
] 

标签: gitazure-devopsazure-resource-manager

解决方案


最佳做法是使用带有 sas 令牌的存储帐户来检索模板。这将允许您安全地引用您的模板 ( https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-powershell-sas-token )。

如果您可以在 url 中传递身份验证(仅获取请求),则可以使用任何安全存储。或者您可以创建一个 azure 函数,将您的请求代理到私有存储并检索模板(显然是 hack)。


推荐阅读