Search code examples
azureazure-devopsazure-pipelinesazure-rm-templateazure-artifacts

can I pass the URL of build artifact to linked ARM template deployment?


I am trying to pass the build artifact path for the linked template but its throwing the below error.

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.

Details:

I have the build artifacts inside the folder manifest. I have a token replacement task to replace files in the manifest like this -> manifest/swagger.json. then I have a deployment task which has one master template and linked template. master template I am able to provide the link such as $(Pipeline.Workspace)/Manifest/Changes/master.json inside that I have parameters for the linked template path and I am passing the path like $(Pipeline.Workspace)/Manifest/Changes/Artifact/something.json.

Does the link for the linked template always has to be an URL like in the samples from storage account. If that's the case, right now we don't have the need for storage account in our project, is there any alternatives to achieve that?

update: though I am passing it from parameter, I am providing the sample directly to make the context clear.

{
      "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')]"
          }
        }
      }

Solution

  • You can't use the pipeline artifact, you need a publicly accessible URL. This is why the samples use a storage account.

    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