azure - 我可以将构建工件的 URL 传递给链接的 ARM 模板部署吗?

标签 azure azure-devops azure-pipelines azure-rm-template azure-artifacts

我试图传递链接模板的构建工件路径,但它抛出以下错误。

InvalidContentLink: The provided content link 'Microsoft.WindowsAzure.ResourceStack.Frontdoor.Data.Entities.Deployments.DeploymentTemplateContentLink' is invalid or not supported. Content link must be an absolute URI not referencing local host or UNC path.

详细信息:

我在文件夹 list 中有构建工件。我有一个 token 替换任务来替换 list 中的文件,如下所示 -> manifest/swagger.json。然后我有一项部署任务,其中有一个主模板和链接模板。主模板我能够提供诸如 $(Pipeline.Workspace)/Manifest/Changes/master.json 之类的链接,其中我有链接模板路径的参数,并且我正在传递类似 $(Pipeline.Workspace)/Manifest 的路径/Changes/Artifact/something.json。

链接模板的链接是否始终必须是存储帐户示例中的 URL。如果是这样的话,现在我们的项目中不需要存储帐户,有没有其他方法可以实现这一点?

更新: 虽然我是从参数传递它,但我直接提供示例以使上下文清晰。

{
      "properties": {
        "mode": "Incremental",
        "templateLink": {
          "uri": "[concat('$(Pipeline.Workspace)/Manifest/Changes/linkedtemplates', '/initial.api.template.json')]",
          "contentVersion": "1.0.0.0"
        },
        "parameters": {
          "ServiceName": {
            "value": "[parameters('ServiceName')]"
          }
        }
      }

最佳答案

您无法使用管道工件,您需要一个可公开访问的 URL。这就是示例使用存储帐户的原因。

When referencing a linked template, the value of uri can't be a local file or a file that is only available on your local network. Azure Resource Manager must be able to access the template. Provide a URI value that downloadable as http or https.

https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/linked-templates#linked-template

关于azure - 我可以将构建工件的 URL 传递给链接的 ARM 模板部署吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65251035/

相关文章:

azure-devops - VSTS 版本 : NuGet Publisher Step Fails

Azure 应用服务计划横向扩展更改事件

c# - 在 Azure WebRole 上自动启动 WCF

azure-devops - 如何向 VSTS 中的任务工作项添加新的事件类型

git - 需要一个git命令,它只给我的源分支(工作分支)更改

node.js - 在自托管 VSO 代理上运行 NPM

azure blob 使用正确的访问 key 返回 403 禁止

azure - 如何停止从 Azure Functions 中的特定函数发送遥测数据?

Azure 板 : Query - Pending Work for an Epic

azure - Azure Pipelines 中失败任务的自定义错误消息