Rohit Raj
Rohit Raj

Reputation: 11

Azure ARM template deployment failure with error Invalid Template

Status: Failed Error: Code: InvalidTemplate Message: Unable to process template language expressions for resource '/subscriptions//resourceGroups//providers/Microsoft.KeyVault/vaults/keyvaultName/secrets/' at line '788' and column '5'. 'The language expression property 'AliasPrimaryConnectionString' doesn't exist, available properties are 'primaryConnectionString, secondaryConnectionString, primaryKey, secondaryKey, keyName'.

The weird thing is that it was working till a week back and we havent made any changes to the template. Logging in to the portal too able to see the AliasPrimaryConnectionString being present in serviceBus access policies as a SAS key. Not sure why template deployment is complaining it cannt find it. The Api Version being used is 2017-04-01.

The relevant template snippet:

{
  "type": "Microsoft.KeyVault/vaults/secrets",
  "name": "[concat(variables('AppKVName'), '/DeviceOrchestrationServiceBusSendKey', if(equals(copyIndex(), 0), '', copyIndex()))]",
  "apiVersion": "2018-02-14",
  "location": "[resourceGroup().location]",
  "dependsOn": [
    "[variables('AppKVName')]"
  ],
  "properties": {
    "value": "[replace(listKeys(resourceId(variables('StorageSubscriptionId'), variables('StorageResourceGroup'), 'Microsoft.ServiceBus/namespaces/topics/authorizationRules',concat(variables('AppServiceBusName'), if(equals(copyIndex(), 0), '', copyIndex())), variables('DeviceOrchestrationTopic'), variables('SendAccessKey')), variables('ServiceBusApiVersion')).AliasPrimaryConnectionString,';EntityPath=deviceorchestrationtopic', '')]"
  },
  "copy": {
    "name": "DeviceOrchestrationServiceBusSendKeyCopy",
    "count": "[variables('PartitionCountDeviceOrchestration')]"
  }
},

Upvotes: 0

Views: 4226

Answers (1)

AjayKumarGhose
AjayKumarGhose

Reputation: 4893

To resolve the above issue we can follow the below workaround:

As mentioned in this MICROSOFT DOCUMENTATION:-

reference(resourceName or resourceIdentifier, [apiVersion], ['Full']) 

This parameter is required when the resource isn'tprovisioned within same template. Typically, in the format, yyyy-mm-dd

  • So please Make sure that When referring resource is not supplied within the same template, the function's second parameter, apiVersion need to mention which is necessary .

For example:-

variables('resourcename'), '2018-02-14').AliasPrimaryConnectionString

For more information please refer this SO THREAD .

Upvotes: 0

Related Questions