I am writing an ARM template that deploys resources forming a part of an application.
- Service Bus, including namespace, queue and authorization rules.
- Azure Function triggered by the queue above.
The AzureWebJobsServiceBus
app setting needs deploying for this Function trigger to work. Of course, the queue connection string contains the shared access key from the authorization rules created within the same ARM template.
I need to somehow build a connection string and refer to the key just made.
"siteConfig": {
"appSettings": [
{
"name": "AzureWebJobsServiceBus",
"value": "[concat('Endpoint=sb://', parameters('serviceBusNamespaceName'), '.servicebus.windows.net/;SharedAccessKeyName=sender-listener;SharedAccessKey=', listKeys(resourceId('Microsoft.ServiceBus/namespaces/queues/authorizationRules', parameters('serviceBusNamespaceName'), '/http-push/sender-listener'),'2015-05-01-preview').key1)]"
},
At the moment, the above is giving me this error.
Deployment template validation failed: 'The template resource 'mycompany-myapp-mycomponent-functionapp' at line '136' and column '9' is not valid: Unable to evaluate template language function 'resourceId': function requires exactly one multi-segmented argument which must be resource type including resource provider namespace.
Update
The error was caused by my dependsOn
though its the same syntax I'm using in my value
above so it feels like progress. The correct syntax for my situation is:
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces/queues/authorizationRules', parameters('serviceBusNamespaceName'), 'queue-name', 'auth-rule-name')]"
],
Still working on the other bit.
Update
Using this as the value for the app setting above causes a new error now.
"[concat('Endpoint=sb://', parameters('serviceBusNamespaceName'), '.servicebus.windows.net/;SharedAccessKeyName=auth-rule-name;SharedAccessKey=', listKeys(resourceId('Microsoft.ServiceBus/namespaces/queues/authorizationRules', parameters('serviceBusNamespaceName'), 'queue-name', 'auth-rule-name'),'2015-05-01-preview').key1)]"
No registered resource provider found for location 'uksouth' and API version '2015-05-01-preview' for type 'namespaces/queues/authorizationrules'. The supported api-versions are '2014-09-01, 2015-08-01, 2017-04-01'. The supported locations are ''.
:(
Update
Switched the version of listKeys
to 2017-04-01
and now have this very useful error!
'The language expression property 'key1' doesn't exist, available properties are 'primaryConnectionString, secondaryConnectionString, primaryKey, secondaryKey, keyName'.'