I have Web App Job project which is configured to pluck messages from an Azure Service Bus and process them.
Presently I have a Functions class and a MessageReceived() method which is used as such:
public async Task MessageReceived( [ServiceBusTrigger("some-queue", Connection="ServiceBusConnectionString")], SomeClass someInstance, int deliveryCount, DateTime enqueuedTimeUtc, string messageId, ILoggerlog) { //message procesing code }
I also have all the KeyVault infrastructure in place, but I don't know how to get the Azure Secrets work with the [ServiceBusTrigger] attribute.
Normally I would use @Microsoft.KeyVault(VaultName=myvault;SecretName=mysecret)
in code, but I don't know how to use it with the trigger.
I have tried to pass the Secret to the Attribute, but that wouldn't work because attributes expect constant values.
Any concrete examples would be appreciated.
@Microsoft.KeyVault(VaultName=<Keyvault name>;SecretName=<Secret Name> ; SecretVersion = <Secret version >)
Here in code my connection string is set to name connection
so we must use the same name for the key vault reference.
output of the service bus trigger: