I am using bicep to create azure resources. One of these resources is a service bus and this is defined as follows:
resource service_bus 'Microsoft.ServiceBus/namespaces@2021-01-01-preview' = {
name: '${service_bus_name}${uniqueString(service_bus_name)}'
location: resourceGroup().location
sku: {
name: 'Standard'
tier: 'Standard'
}
properties: {}
}
I then want to use this service bus in another resource and this is what I currently have for the connection string:
name: 'AzureWebJobsServiceBus'
value: 'Endpoint=sb://${service_bus.name}.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=<hardcoded_key>'
How can I avoid the hard coded key. I tried using listKeys like this:
SharedAccessKey=${listKeys(service_bus.id, service_bus.apiVersion).value[0].primaryKey}
But this does not work, and variations on this also fail.