Question

Difficulty: MediumDeploy and Configure Azure Container Apps

You are developing a background worker application that runs in Azure Container Apps. The application must scale dynamically based on the message count of an Azure Service Bus queue. You plan to use a user-assigned managed identity to authenticate the container app's scale rules with the Service Bus namespace.

Which sequence of steps should you perform to configure the scaling and security?

  1. 1Create a user-assigned managed identity.
  2. 2Assign the Azure Service Bus Data Receiver role to the managed identity.
  3. 3Associate the user-assigned managed identity with the Container App.
  4. 4Configure a scaling rule of type azure-servicebus on the Container App, referencing the identity.

Answer

Create the user-assigned managed identity, assign the Service Bus Data Receiver role to it, associate the identity with the Container App, and then configure the Service Bus scale rule referencing the identity.
The correct sequence begins with creating the user-assigned managed identity. Next, you must grant it the permissions needed to read from the queue by assigning the Azure Service Bus Data Receiver role. You then associate the identity with the Container App resource. Finally, you configure the azure-servicebus scale rule, referencing the associated identity.

Step-by-Step Solution

1
Create the user-assigned managed identity.
The identity is provisioned in Azure, generating a unique principal ID and client ID.
You must have a physical identity resource before you can assign roles or link it to other Azure resources.
2
Assign the Azure Service Bus Data Receiver role to the managed identity at the queue scope.
The identity is granted permissions to read from the target Service Bus queue.
The Container App's scaling mechanism (KEDA) runs on the host environment and uses this identity to authenticate and read the queue depth.
3
Associate the user-assigned managed identity with the Container App.
The Container App resource definition is updated to include the identity in its identity block.
The Container App must explicitly own or be associated with the user-assigned identity before it can reference it in configuration settings.
4
Add the azure-servicebus scale rule referencing the associated identity.
The scaling engine uses the associated identity to read queue depth and scale the container instances.
The scale rule configures the actual KEDA scaler, which depends on the identity association and role permissions setup in the preceding steps.

Key Concept

Azure Container Apps scale rules (KEDA) require a managed identity associated with the Container App and granted appropriate permissions on the target resource (like Service Bus) to monitor metrics for autoscaling.
Estimated Time:1m 30s
Rate this question