Soru

Zorluk: Çok zorDeploy and Configure Azure Container Apps

You are developing a Bicep template to deploy an Azure Container App named `order-processor`. The application must dynamically scale using KEDA based on the length of an Azure Service Bus queue named `orders-queue`. The Service Bus namespace is `sb-orders.servicebus.windows.net`.

Security requirements dictate that no connection strings or secrets may be stored within the Container App's settings or configuration. You have created a User-Assigned Managed Identity named `order-processor-identity` with the resource ID `/subscriptions/sub1/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/order-processor-identity` and assigned it the 'Azure Service Bus Data Receiver' role.

Which Bicep configuration block correctly configures the managed identity at the resource level and the KEDA scale rule to use this identity for passwordless authentication?

  1. identity: {
    type: 'UserAssigned'
    userAssignedIdentities: {
    '/subscriptions/sub1/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/order-processor-identity': {}
    }
    }
    properties: {
    template: {
    scale: {
    minReplicas: 1
    maxReplicas: 10
    rules: [
    {
    name: 'queue-scaler'
    custom: {
    type: 'azure-servicebus'
    metadata: {
    queueName: 'orders-queue'
    namespace: 'sb-orders.servicebus.windows.net'
    messageCount: '10'
    }
    identity: '/subscriptions/sub1/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/order-processor-identity'
    }
    }
    ]
    }
    }
    }
    Cevap
  2. B
    identity: {
    type: 'UserAssigned'
    userAssignedIdentities: {
    '/subscriptions/sub1/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/order-processor-identity': {}
    }
    }
    properties: {
    template: {
    scale: {
    minReplicas: 1
    maxReplicas: 10
    rules: [
    {
    name: 'queue-scaler'
    custom: {
    type: 'azure-servicebus'
    metadata: {
    queueName: 'orders-queue'
    namespace: 'sb-orders.servicebus.windows.net'
    messageCount: '10'
    }
    identity: 'system'
    }
    }
    ]
    }
    }
    }
  3. C
    identity: {
    type: 'UserAssigned'
    userAssignedIdentities: {
    '/subscriptions/sub1/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/order-processor-identity': {}
    }
    }
    properties: {
    template: {
    scale: {
    minReplicas: 1
    maxReplicas: 10
    rules: [
    {
    name: 'queue-scaler'
    custom: {
    type: 'azure-servicebus'
    metadata: {
    queueName: 'orders-queue'
    namespace: 'sb-orders.servicebus.windows.net'
    messageCount: '10'
    }
    identity: 'order-processor-identity'
    }
    }
    ]
    }
    }
    }
  4. D
    identity: {
    type: 'UserAssigned'
    userAssignedIdentities: {
    '/subscriptions/sub1/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/order-processor-identity': {}
    }
    }
    properties: {
    template: {
    scale: {
    minReplicas: 1
    maxReplicas: 10
    rules: [
    {
    name: 'queue-scaler'
    custom: {
    type: 'azure-servicebus'
    metadata: {
    queueName: 'orders-queue'
    namespace: 'sb-orders.servicebus.windows.net'
    messageCount: '10'
    }
    auth: [
    {
    triggerParameter: 'connection'
    secretRef: 'order-processor-identity'
    }
    ]
    }
    }
    ]
    }
    }
    }

Cevap

The configuration that sets the root identity type to 'UserAssigned', includes the full resource ID of the user-assigned managed identity, and defines the scale rule using the custom block with the exact same resource ID in the identity property.
The correct Bicep snippet defines the root identity property as 'UserAssigned' and lists the full resource ID of the identity. In the scale rule, it configures KEDA by using the custom property block. For managed-identity based scaling on Azure Service Bus, KEDA needs the Service Bus namespace and queue name under metadata, and the full resource ID of the User-Assigned Managed Identity assigned directly to the scale rule's custom 'identity' property.

Adım Adım Çözüm

1
Enable the User-Assigned Managed Identity on the Container App resource.
The identity property is set with type 'UserAssigned' and the key-value pair of the user-assigned managed identity's resource ID.
This registers the identity with the container app so that it has permission to assume it.
2
Define the scaling rule using the custom scaler structure for KEDA.
The scaler type is set to 'azure-servicebus', and metadata contains the queue name and Service Bus namespace instead of a connection string.
By using the namespace field, the scaler knows it must authenticate using passwordless methods rather than a connection string.
3
Configure the identity property within the custom scale rule block.
The identity field is set to the full resource ID of the User-Assigned Managed Identity.
Azure Container Apps scale rules require the full resource ID of the user-assigned identity to authenticate KEDA against the Service Bus namespace.

Anahtar Kavram

Configuring passwordless KEDA scale rules in Azure Container Apps using User-Assigned Managed Identities in Bicep.
Bu soruyu puanla