When you deploy templates with some linked templates, the linked templates should be stored public or limited access wtih SAS token. But this sometimes makes difficult to setup CI/CD pipeline on Visual Studio Team Service(VSTS). You can understand how to setup this with this article and GitHub - normalian/ARMTemplate-SASToken-InVSTS-Sample.
You can generate SAS token with VSTS task in build process and pass the value with VSTS variables, and you can also override ARM template parameters with VSTS tasks. This is key concepts of this article.
In VSTS Build Process
Create "Azure PowerShell script" task and "Azure Deployment: Create Or Update Resource Group Action" like below.
Azure PowerShell script: inline Script – inline script
Edit "Azure PowerShell script" task like below.
$context = New-AzureStorageContext -StorageAccountName 'your storage account name' -StorageAccountKey 'your storage access key' $sasUrl = New-AzureStorageContainerSASToken -Container templates -Permission rwdl -Context $context Write-Output ("##vso[task.setvariable variable=SasUrl;]$sasUrl")
You can store generated values with VSTS variables like above.
Azure Resource Group Deployment - Override template parameters
Edit "Azure Deployment: Create Or Update Resource Group Action" like below.
-SASToken $(SasUrl)
Part of ARM template
Now you can use SAS token to specify your linked templates like below. Refer this sample if you need.
"variables": { "sharedTemplateUrl": "[concat('https://'your storage account name'.blob.core.windows.net/templates/blank-azuredeploy.json', parameters('SASToken') )]", "sharedParametersUrl": "[concat('https://'your storage account name'.blob.core.windows.net/templates/blank-azuredeploy.parameters.json', parameters('SASToken'))]" },