microsoft / azure-container-apps

Roadmap and issues for Azure Container Apps
MIT License
372 stars 29 forks source link

Scale rule for azure service bus with user assigned identity #1344

Open karpikpl opened 1 week ago

karpikpl commented 1 week ago

This issue is a: (mark with an x)

Issue description

Creating container app with bicep does not set managed identity on the scale rule

    scaleRules: [
      {
        // https://keda.sh/docs/2.0/scalers/azure-service-bus/
        name: 'azure-servicebus-topic-rule'
        custom: {
          type: 'azure-servicebus'
          identity: userIdentity.id
          metadata: {
            topicName: serviceBusTopicName
            subscriptionName: serviceBusSubscriptionName
            namespace: serviceBusName
            messageCount: '5'
          }
        }
      }
    ]

bicep: Microsoft.App/containerApps@2024-10-02-preview

Steps to reproduce

  1. Run bicep deployment with scale rule
  2. Verify it was created correctly in azure portal

Expected behavior [What you expected to happen.] Scale rule is created with user assigned managed identity.

Actual behavior [What actually happened.] Managed identity is not set.

Screenshots
Image

Additional context

Scale rule can be updated in the portal and produces exactly the same JSON as the one in the sample: identity: userIdentity.id. Verified in ARM deployments that correct JSON is sent.

perry2of5 commented 1 week ago

I've encountered a similar issue trying to set the identity with --scale-rule-identity, there it checks the box but doesn't select the identity. Perhaps that is a different issue? Or maybe it has the same root cause.

karpikpl commented 1 week ago

I use AZD for deployment and it seems first deployment "checks the checkbox" but identity is not selected. Next deployment (AZD does two - one for provision, one for deployment) removes the check.

v-vish commented 4 days ago

@karpikpl We are currently investigating this issue. Please allow us some time, and we will get back to you with an update soon.

karpikpl commented 3 days ago

Thanks @v-vish I'm also trying to reproduce the issue where my container looks stopped after deployment with a service bus scale rule. The scaling is setup to scale between 1 and 10 so there always should be an active service bus listener present, however my queue was full of messages and nothing was picking them up. Restarting the container app solved the issue.

I'm having some issues with reproducing it though :/