This is a retrospective. I had an Azure Function, connected to a ServieBus Topic for message processing. It functions, messages triggered the function, function processed the message, all good, except it didn't scale no matter how many message was stacked up in the topic.
To debug it, I built a lab with mimimum components. To share some context, this is how the trigger attribute looks like on the function:
[Function("OnGetMessage")]
public void Run([ServiceBusTrigger("message", "message-sub", Connection = "LabServiceBus")] string mySbMsg)
And my settings:
Settings | Value | Comment |
---|---|---|
AzureWebJobsLabServiceBus__clientId | redacted | Managed identity client id |
AzureWebJobsLabServiceBus__credential | managedidentity | Hard coded string so that the trigger knows it is using user assigned managed identity |
AzureWebJobsLabServiceBus__fullyQualifiedNamespace | redacted.servicebus.windows.net | The service bus to connecting to. |
I was clueless at the beginning, wondering if that was just scale controller's insensitivivy or maybe some permission issues until I know there's options to turn on the logs for the scale controller:
And I got these logs back:
... Specified connection string is null or empty for connection: LabServiceBus. Invalid connection.;
It was confusion because the trigger uses managed identity with the settings without issue. Why the scale controller was complaining? It turned out the scale controller doesn't take settings with prefix well.
Change AzureWebJobsLabServiceBus to LabServiceBus
by removing the prefix made it work.
- I also heard for other cases, like hooking up with EventHub, it requires the prefix to be there - let's say I have some connections :-)
- It is important to see messages in the log.
- I hope it would be more consistent dealing with Prefixes in settings for the scale controller.
- I wasn't alone for this issue. People have gave me great help and I want to say thank you to those helped.
- I trid both emitting logs to Blob and to App Insights. Log file in blob is easy to recognize; In AppInsights, it mixed in traces but marked by some common property (now that the lab is gone, I can't remember what exactly).