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:
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.