-1

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')]"
  }
},
Rohit Raj
  • 1
  • 2
  • Could you share the ARM template with us please ? or at least relevant parts of it – Thomas Jun 16 '22 at 23:27
  • is AliasPrimaryConnectionString still available in the KeyVault? And is its value set? – Charlie V Jun 17 '22 at 10:57
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jun 17 '22 at 10:57
  • Thanks for looking. Shared the relevant arm template. @CharlieV AliasPrimaryConnectionString is available in ServiceBus SAS keys, since we have geo DR enabled. – Rohit Raj Jun 17 '22 at 18:16

1 Answers1

0

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 .

AjayKumarGhose
  • 4,257
  • 2
  • 4
  • 15