Skip to content

ServiceBus trigger with managed identity doesn't wake up consumption plan function apps when Connection isn't explicitly defined #8261

Open
@Archomeda

Description

@Archomeda

This is for in-process v4 function apps, I'm unsure whether this also applies to the isolated variant.

When a Service Bus trigger is defined with a connection via managed identity, the function app doesn't get woken up by Azure when the Connection property is not defined in the trigger attribute, despite the trigger working fine when the function app is active.

Investigative information

  • Timestamp: 2022-03-22T02:58:56.0115521Z
  • Invocation ID: 6309186b-c3f9-43f1-abeb-6f6385cd7c10 (one of many)
  • Region: West Europe

Repro steps

  1. Create a function app with a service bus trigger via managed identity without specifying the Connection property
  2. Publish to Azure
  3. Wait for the function app to go inactive
  4. Post a message to the service bus queue

Expected behavior

The function app should get woken up and the service bus triggered function should get triggered.
As far as I know, the Connection property was never mandatory for triggers that use connection strings, so this feels like an invisible breaking change when moving to managed identity based connections.

Actual behavior

The function app does not get woken up, and the service bus triggered function is not triggered.

Known workarounds

Define the Connection property that points to the name of the configuration (and gets resolved to <ConnectionName>__fullyQualifiedNamespace).

Related information

I've noticed that the generated function.json only includes the connection field if the Connection property is defined. This makes me believe that the default value "ServiceBus" is only considered in the functions runtime, and not in the Azure scale controller for function apps.

Source
[FunctionName("ServiceBusTest")]
public Task Run([ServiceBusTrigger("queue-name")] QueueMessage message)
{
    // This doesn't get triggered if the function app is inactive
}

The second trigger generates a function.json file with the connection property, because it's now explicitly defined:

[FunctionName("ServiceBusTest2")]
public Task Run([ServiceBusTrigger("queue-name", Connection = "ServiceBus")] QueueMessage message)
{
    // This does get triggered if the function app is inactive
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions