How to configure service bus connection string?

Jingkan He 6 Reputation points Microsoft Employee Moderator
2023-06-28T20:58:25.77+00:00

I'm a new developer with Azure SDK development, I'd like to collect the detail like how to configure Azure Service Bus step-by-step. Could you also write a sample code for Azure function which is triggered by service bus queue in C#?

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
697 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Saurabh Sharma 23,846 Reputation points Microsoft Employee Moderator
    2023-06-28T23:35:44.8866667+00:00

    Hi @Jingkan He ,

    Thanks for using Microsoft Q&A!!

    You can refer to the documentation to understand the basic scenario of using Service Bus client library (.NET) for sending a batch of messages to a service bus queue and then receiving them. This tutorial provides step by step instructions to create a service bus queue and then using the .NET SDK.

    You can also refer to the existing samples which covers various scenarios like "Authenticating, using CRUD operations, managing dead letter queues, etc." of Service Bus.

    Please refer to Azure Service Bus trigger for Azure Functions which talks about using Azure Service Bus along with Azure Functions where Azure function is triggered by the Service Bus queue message. This documentation also talks about setting up the Service Bus connection string.

    You basically need to use the "Connection" Property in Function bindings to define the function app setting name which holds Service Bus Connection String. (See Screenshot below) Function App Bindings: User's image

    Function App Settings:User's image

    Azure function looks for app setting AzureWebJobsServiceBus for the Service Bus connection string when the explicit Connection property is not defined.

    Please let me know if you have any other questions.

    Thanks

    Saurabh


    Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.


Your answer

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