In a previous post, I wrote about creating Azure Container Apps using az containerapp create --kind functionapp (az functionapp create VS az containerapp create --kind functionapp).
One of the main advantages of this approach is these function apps are preconfigured with auto scaling rules for triggers like Azure Service Bus, Azure Event Hubs etc.
However, in one of our Function Apps that was running on Azure Container Apps, noticed the scaling rules wasn't created for Service Bus Functions.
|
Only 1 rule for http-scale-rule |
az containerapp update `
--name $ContainerAppName `
--resource-group $ResourceGroup `
--image $Image `
--set-env-vars `
"AzureWebJobsStorage=<AzureWebJobsStorage>" `
'AZURE_CLIENT_ID="<ManagedIdentityClientId>"' `
'AzureWebJobsServiceBus="<ServiceBus_ConnectionString>"'
In order for KEDA scaling rules to configure, we need to be using Identity-based Connections instead of secrets.
Something like,
az containerapp update `
--name $ContainerAppName `
--resource-group $ResourceGroup `
--image $Image `
--set-env-vars `
"AzureWebJobsStorage=<AzureWebJobsStorage>" `
'AZURE_CLIENT_ID="<ManagedIdentityClientId>"' `
'AzureWebJobsServiceBus__fullyQualifiednamespace="<ServiceBusName>.servicebus.windows.net"'
Here for identity-based Connection, we don't need to set <CONNECTION_NAME_PREFIX>__clientId as AZURE_CLIENT_ID is declared and it will be used as <CONNECTION_NAME_PREFIX>__clientId. However, we can explicitly set <CONNECTION_NAME_PREFIX>__clientId to override the default.
And now the rules are auto configured as expected.
|
Expected Output |
|
Scale Rules |
Azure Functions on Azure Container Apps overview
Azure Functions: Connection values
Tutorial: Use identity-based connections instead of secrets with triggers and bindings
Hope this helps.
Happy Coding.
Regards,
Jaliya
No comments:
Post a Comment