Is there a way to access the linked template on a private blob storage using 'listkeys'. That way I don't need to generate a SAS token each time I deploy. Something along the lines of:
"Concat('DefaultEndpointsProtocol=https;AccountName=',variables('StorageAccountName'),';AccountKey=',listKeys(resourceId('otherResourceGroup', 'Microsoft.Storage/storageAccounts', variables('StorageAccountName')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value)]"
To go in:
"parameters": {
"sasToken": { "type": "securestring" }
},
"resources": [
{
"apiVersion": "2017-05-10",
"name": "linkedTemplate",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "incremental",
"templateLink": {
"uri": "[concat('https://storagecontosotemplates.blob.core.windows.net/templates/helloworld.json', parameters('sasToken'))]",
"contentVersion": "1.0.0.0"
}
}
}
],
MS document doesn't mention it, but it would be easy to deploy without having to generate a token.
In response to Tom as to why I can't use the keyVault, because it still requires it to be input. Here is the code for the token which needs to be inside parameters:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"value": "cmdbAdmin"
},
"adminPassword": {
"reference": {
"keyVault": {
"id": "/subscriptions/c8727b53-932a-4f48-9fa1-00765c554992/resourceGroups/AnsibleTest1/providers/Microsoft.KeyVault/vaults/ansibletest"
},
"secretName": "adminPassword"
}
},
...and it appears like this in Azure templates. As you can see, you will still need to put in some credentials :(