Understanding ARM Templates _artifactsLocation

I’m someone that is always interested in seeing what’s behind the curtain, pulling apart designs to understand the why and the how. When I began working with ARM templates, I noticed there were two parameters that Microsoft always included in the default template. These parameters were used in the template, but generally never had a value assigned to them. I’m talking about:

  • _artifactsLocation
  • _artifactsLocationSasToken

I decided it was time to understand the reason for these parameters and how to best take advantage of them. I find that a lot of people don’t understand these fields. So — let’s discuss!

If you’ve created a deployment project, you’ve undoubtedly seen these two values in your template. If you’ve used linked templates, you’ll have come to rely on these parameters.

These two values are used to create a URL which represents the complete path to the linked file, usually an ARM template or dependency that’s part of the same deployment. In order to use these values, they are exposed as parameters from the ARM template.

The first value,_artifactsLocation, represents the base URL for a path where the documents will be staged. This path must be a publicly accessible URL. The _artifactsLocationSasToken is a query string appended to the URI, typically containing a generated SAS token. This ensures that a public reference exists for templates which are hosted in a private location. Concatenated in between these two values is the file being referenced:

"[uri(parameters('_artifactsLocation'), concat('deploy.json', parameters('_artifactsLocationSasToken')))]"

So, how do these values get populated? If you attempt to deploy the templates using Visual Studio, those values will show as auto-generated:

A storage location will be created, the files we be uploaded, and the appropriate values generated automatically. If you are deploying in PowerShell using the Deploy-AzureResourceGroup.ps1 created Visual Studio and do not specify values for the parameters, a similar process will occur. The files will be uploaded and the two values will be automatically populated.

For most other cases (or to have more control over the process), you will need to specify those values manually to ensure that any reference templates or files can be properly resolved.

Ken Muse

Recent Posts

8-Step AWS to Microsoft Azure Migration Strategy

Microsoft Azure and Amazon Web Services (AWS) are two of the most popular cloud platforms.…

2 days ago

How to Navigate Azure Governance

 Cloud management is difficult to do manually, especially if you work with multiple cloud…

1 week ago

Why Azure’s Scalability is Your Key to Business Growth & Efficiency

Azure’s scalable infrastructure is often cited as one of the primary reasons why it's the…

3 weeks ago

Unlocking the Power of AI in your Software Development Life Cycle (SDLC)

https://www.youtube.com/watch?v=wDzCN0d8SeA Watch our "Unlocking the Power of AI in your Software Development Life Cycle (SDLC)"…

1 month ago

The Role of FinOps in Accelerating Business Innovation

FinOps is a strategic approach to managing cloud costs. It combines financial management best practices…

1 month ago

Azure Kubernetes Security Best Practices

Using Kubernetes with Azure combines the power of Kubernetes container orchestration and the cloud capabilities…

2 months ago