Share via

ServiceBusTrigger function is not triggered when connected to a topic/subscription on docker running emulator

Hiroshi Tashiro 65 Reputation points Microsoft Employee
2026-01-22T17:34:42.67+00:00

Describe the bug ServiceBusTrigger is not triggered when it's connected to a topic/subscription on docker running emulator. Messages were sent to the topic via ServiceBusClient and they can also be received via ServiceBusClient. However, ServiceBusTrigger is not triggered.

To Reproduce Set up a local emulator with docker and default settings by following the doc. Remove queues and leave topics subscriptions. Create a function with a service bus trigger and add the connection string.

Trigger definition in C#

[Function("NotificationTrigger")]
public void Run(
    [ServiceBusTrigger(
        topicName: "%TopicName%",
        subscriptionName: "%SubscriptionName%",
        Connection = "NotificationServiceConnection")]
    ServiceBusReceivedMessage sbMessage)
{
    // Process the Service Bus message
    string messageBody = sbMessage.Body.ToString();
    this.logger.LogInformation($"OneMdmNotificationTrigger received message: {messageBody}");
}

local.settings.json

{
  "IsEncrypted": false,
  "Values": {
   ...
    "OneMDMNotificationServiceConnection": "Endpoint=sb://localhost:5672;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;",
    "TopicName": "TOPICNAME",
    "SubscriptionName": "SUBSCRIPTIONNAME",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
  }
}

Expected behavior ServiceBusTrigger to be triggered when messages are sent to the topic.

Please check https://github.com/Azure/azure-service-bus-emulator-installer/issues/115 for more details.

Azure Service Bus
Azure Service Bus

An Azure service that provides cloud messaging as a service and hybrid integration.


Answer accepted by question author
  1. Rakesh Mishra 7,215 Reputation points Microsoft External Staff Moderator
    2026-01-22T18:46:12.91+00:00

    Hi @Hiroshi Tashiro ,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    The behavior you are seeing is a known limitation of the current Azure Service Bus Emulator. 

    The Root Cause: There is a distinction between the Data Plane (sending/receiving messages) and the Control Plane (managing entities, checking counts, verifying rules).

    • ServiceBusClient (Working): Your manual client code uses pure AMQP (Data Plane) to send/receive, which the emulator supports fully.  
    • ServiceBusTrigger (Failing): The Azure Functions Runtime tries to perform Management operations (Control Plane) during startup—such as verifying the subscription exists, checking active message counts for scaling, or validating filters. The emulator currently does not fully implement these management endpoints. As a result, the Functions Host fails to "bind" the listener, even though the connection string is valid.

    Recommended Workarounds:

    1. Use a Queue for Local Testing: The emulator's support for Queues is much more robust than for Topics/Subscriptions. If you are just testing the processing logic of your function, switch the trigger to a Queue temporarily for local Docker runs.
    2. Use a Real Dev Namespace: For testing Topic/Subscription triggers specifically (especially with filters), it is currently recommended to use a real Azure Service Bus namespace (Basic or Standard tier) instead of the emulator.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.