You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/service-bus-messaging/includes/service-bus-create-topic-subscription-portal.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
author: spelluru
5
5
ms.service: azure-service-bus
6
6
ms.topic: include
7
-
ms.date: 10/11/2021
7
+
ms.date: 01/16/2025
8
8
ms.author: spelluru
9
9
ms.custom: include file
10
10
---
@@ -15,18 +15,17 @@
15
15
4. Enter a **name** for the topic. Leave the other options with their default values.
16
16
5. Select **Create**.
17
17
18
-
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/create-topic.png" alt-text="Image showing the Create topic page.":::
18
+
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/create-topic.png" alt-text="Screenshot tthat shows the Create topic page in the Azure portal.":::
19
19
20
20
## Create a subscription to the topic
21
21
1. Select the **topic** that you created in the previous section.
22
22
23
-
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/select-topic.png" alt-text="Image showing the selection of topic from the list of topics.":::
23
+
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/select-topic.png" alt-text="Screenshot that shows the selection of topic from the list of topics.":::
24
24
2. On the **Service Bus Topic** page, select **+ Subscription** on the toolbar.
25
25
26
-
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/add-subscription-button.png" alt-text="Image showing the Add subscription button.":::
26
+
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/add-subscription-button.png" alt-text="Screenshot that shows the Add subscription button on the Topic page.":::
27
27
3. On the **Create subscription** page, follow these steps:
28
28
1. Enter **S1** for **name** of the subscription.
29
-
1. Enter **3** for **Max delivery count**.
30
29
1. Then, select **Create** to create the subscription.
31
30
32
-
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/create-subscription-page.png" alt-text="Image showing the Create subscription page.":::
31
+
:::image type="content" source="./media/service-bus-create-topics-subscriptions-portal/create-subscription-page.png" alt-text="Screenshot that shows the Create subscription page.":::
# Customer intent: I want to learn how to send messages to an Azure Service Bus queue and receive messages from it.
9
10
---
10
11
11
12
# Quickstart: Send and receive messages from an Azure Service Bus queue (.NET)
12
13
13
-
In this quickstart, you'll do the following steps:
14
+
In this quickstart, you do the following steps:
14
15
15
16
1. Create a Service Bus namespace, using the Azure portal.
16
17
2. Create a Service Bus queue, using the Azure portal.
17
18
3. Write a .NET console application to send a set of messages to the queue.
18
19
4. Write a .NET console application to receive those messages from the queue.
19
20
20
-
> [!NOTE]
21
-
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus queue and then receiving them. For an overview of the .NET client library, see [Azure Service Bus client library for .NET](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/servicebus/Azure.Messaging.ServiceBus/README.md). For more samples, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
21
+
This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus queue and then receiving them. For an overview of the .NET client library, see [Azure Service Bus client library for .NET](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/servicebus/Azure.Messaging.ServiceBus/README.md). For more samples, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
22
22
23
23
## Prerequisites
24
24
25
25
If you're new to the service, see [Service Bus overview](service-bus-messaging-overview.md) before you do this quickstart.
26
26
27
27
-**Azure subscription**. To use Azure services, including Azure Service Bus, you need a subscription. If you don't have an existing Azure account, you can sign up for a [free trial](https://azure.microsoft.com/free/dotnet).
28
-
-**Visual Studio 2022**. The sample application makes use of new features that were introduced in C# 10. You can still use the Service Bus client library with previous C# language versions, but the syntax might vary. To use the latest syntax, we recommend that you install .NET 6.0, or higher and set the language version to `latest`. If you're using Visual Studio, versions before Visual Studio 2022 aren't compatible with the tools needed to build C# 10 projects.
28
+
-**Visual Studio 2022**. The sample application makes use of new features that were introduced in C# 10. You can still use the Service Bus client library with previous C# language versions, but the syntax might vary. To use the latest syntax, we recommend that you install .NET 6.0, or higher and set the language version to `latest`. If you're using Visual Studio, versions before Visual Studio 2022 aren't compatible with the tools needed to build C# 10 projects.
> If you are new to Azure, you might find the **Connection String** option easier to follow. Select the **Connection String** tab to see instructions on using a connection string in this quickstart. We recommend that you use the **Passwordless** option in real-world applications and production environments.
35
+
> If you're new to Azure, you might find the **Connection String** option easier to follow. Select the **Connection String** tab to see instructions on using a connection string in this quickstart. We recommend that you use the **Passwordless** option in real-world applications and production environments.
You can authorize access to the service bus namespace using the following steps:
42
44
@@ -49,6 +51,10 @@ You can authorize access to the service bus namespace using the following steps:
49
51
50
52
:::image type="content" source="..//storage/blobs/media/storage-quickstart-blobs-dotnet/sign-in-visual-studio-account-small.png" alt-text="Screenshot showing the account selection.":::
51
53
54
+
### [Connection String](#tab/connection-string)
55
+
Launch Visual Studio. If you see the **Get started** window, select the **Continue without code** link in the right pane.
56
+
57
+
---
52
58
53
59
## Send messages to the queue
54
60
@@ -260,7 +266,7 @@ This section shows you how to create a .NET console application to send messages
260
266
```
261
267
262
268
> [!IMPORTANT]
263
-
> In most cases, it will take a minute or two for the role assignment to propagate in Azure. In rare cases, it might take up to **eight minutes**. If you receive authentication errors when you first run your code, wait a few moments and try again.
269
+
> In most cases, it takes a minute or two for the role assignment to propagate in Azure. In rare cases, it might take up to **eight minutes**. If you receive authentication errors when you first run your code, wait a few moments and try again.
264
270
8. In the Azure portal, follow these steps:
265
271
1. Navigate to your Service Bus namespace.
266
272
1. On the **Overview** page, select the queue in the bottom-middle pane.
@@ -676,12 +682,8 @@ In this section, you add code to retrieve messages from the queue.
676
682
- In the **Messages** chart in the bottom **Metrics** section, you can see that there are three incoming messages and three outgoing messages for the queue.
677
683
678
684
:::image type="content" source="./media/service-bus-dotnet-get-started-with-queues/queue-messages-size-final.png" alt-text="Screenshot showing active messages and size after receive." lightbox="./media/service-bus-dotnet-get-started-with-queues/queue-messages-size-final.png":::
679
-
680
-
## Clean up resources
681
685
682
-
Navigate to your Service Bus namespace in the Azure portal, and select **Delete** on the Azure portal to delete the namespace and the queue in it.
683
-
684
-
## See also
686
+
## Additional information
685
687
686
688
See the following documentation and samples:
687
689
@@ -690,7 +692,10 @@ See the following documentation and samples:
690
692
- [.NET API reference](/dotnet/api/azure.messaging.servicebus)
691
693
- [Abstract away infrastructure concerns with higher-level frameworks like NServiceBus](./build-message-driven-apps-nservicebus.md)
692
694
693
-
## Next steps
695
+
## Clean up resources
696
+
697
+
Navigate to your Service Bus namespace in the Azure portal, and select **Delete** on the Azure portal to delete the namespace and the queue in it.
698
+
699
+
## Related content
700
+
See [Get started with Azure Service Bus topics and subscriptions (.NET)](service-bus-dotnet-how-to-use-topics-subscriptions.md).
694
701
695
-
> [!div class="nextstepaction"]
696
-
> [Get started with Azure Service Bus topics and subscriptions (.NET)](service-bus-dotnet-how-to-use-topics-subscriptions.md)
# Quickstart: Get started with Azure Service Bus topics and subscriptions (.NET)
19
13
20
14
This quickstart shows how to send messages to a Service Bus topic and receive messages from a subscription to that topic by using the [Azure.Messaging.ServiceBus](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/) .NET library.
21
15
22
-
In this quickstart, you'll do the following steps:
16
+
In this quickstart, you do the following steps:
23
17
24
18
1. Create a Service Bus namespace, using the Azure portal.
25
19
2. Create a Service Bus topic, using the Azure portal.
@@ -28,8 +22,8 @@ In this quickstart, you'll do the following steps:
28
22
5. Write a .NET console application to receive those messages from the subscription.
29
23
30
24
> [!NOTE]
31
-
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus topic and receiving those messages from a subscription of the topic. For more samples on other and advanced scenarios, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
32
-
> - This quick start shows you two ways of connecting to Azure Service Bus: **connection string** and **passwordless**. The first option shows you how to use a connection string to connect to a Service Bus namespace. The second option shows you how to use your security principal in Microsoft Entra ID and the role-based access control (RBAC) to connect to a Service Bus namespace. You don't need to worry about having hard-coded connection string in your code or in a configuration file or in secure storage like Azure Key Vault. If you are new to Azure, you might find the connection string option easier to follow. We recommend using the passwordless option in real-world applications and production environments. For more information, see [Authentication and authorization](service-bus-authentication-and-authorization.md).
25
+
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus topic and receiving those messages from a subscription of the topic. For more samples on other and advanced scenarios, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
26
+
> - This quick start shows you two ways of connecting to Azure Service Bus: **connection string** and **passwordless**. The first option shows you how to use a connection string to connect to a Service Bus namespace. The second option shows you how to use your security principal in Microsoft Entra ID and the role-based access control (RBAC) to connect to a Service Bus namespace. You don't need to worry about having hard-coded connection string in your code or in a configuration file or in secure storage like Azure Key Vault. If you're new to Azure, you might find the connection string option easier to follow. We recommend using the passwordless option in real-world applications and production environments. For more information, see [Authentication and authorization](service-bus-authentication-and-authorization.md).
33
27
34
28
## Prerequisites
35
29
@@ -44,23 +38,32 @@ If you're new to the service, see [Service Bus overview](service-bus-messaging-o
You can authorize access to the service bus namespace using the following steps:
50
46
51
47
1. Launch Visual Studio. If you see the **Get started** window, select the **Continue without code** link in the right pane.
52
48
1. Select the **Sign in** button in the top right of Visual Studio.
53
49
54
-
:::image type="content" source="./media/service-bus-dotnet-get-started-with-queues/azure-sign-button-visual-studio.png" alt-text="Screenshot showing the button to sign in to Azure using Visual Studio.":::
50
+
:::image type="content" source="./media/service-bus-dotnet-get-started-with-queues/azure-sign-button-visual-studio.png" alt-text="Screenshot showing a button to sign in to Azure using Visual Studio.":::
51
+
55
52
1. Sign-in using the Microsoft Entra account you assigned a role to previously.
56
53
57
54
:::image type="content" source="..//storage/blobs/media/storage-quickstart-blobs-dotnet/sign-in-visual-studio-account-small.png" alt-text="Screenshot showing the account selection.":::
58
55
56
+
### [Connection String](#tab/connection-string)
57
+
Launch Visual Studio. If you see the **Get started** window, select the **Continue without code** link in the right pane.
58
+
59
+
---
60
+
61
+
59
62
## Send messages to the topic
60
63
This section shows you how to create a .NET console application to send messages to a Service Bus topic.
61
64
62
65
> [!NOTE]
63
-
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus topic and receiving those messages from a subscription of the topic. For more samples on other and advanced scenarios, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
66
+
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus topic and receiving those messages from a subscription of the topic. For more samples on other and advanced scenarios, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
64
67
65
68
### Create a console application
66
69
@@ -244,7 +247,7 @@ This section shows you how to create a .NET console application to send messages
244
247
```
245
248
246
249
> [!IMPORTANT]
247
-
> In most cases, it will take a minute or two for the role assignment to propagate in Azure. In rare cases, it might take up to **eight minutes**. If you receive authentication errors when you first run your code, wait a few moments and try again.
250
+
> In most cases, it takes a minute or two for the role assignment to propagate in Azure. In rare cases, it might take up to **eight minutes**. If you receive authentication errors when you first run your code, wait a few moments and try again.
248
251
1. In the Azure portal, follow these steps:
249
252
1. Navigate to your Service Bus namespace.
250
253
1. On the **Overview** page, in the bottom-middle pane, switch to the **Topics** tab, and select the Service Bus topic. In the following example, it's `mytopic`.
@@ -261,7 +264,7 @@ This section shows you how to create a .NET console application to send messages
261
264
In this section, you create a .NET console application that receives messages from the subscription to the Service Bus topic.
262
265
263
266
> [!NOTE]
264
-
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus topic and receiving those messages from a subscription of the topic. For more samples on other and advanced scenarios, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
267
+
> This quick start provides step-by-step instructions to implement a simple scenario of sending a batch of messages to a Service Bus topic and receiving those messages from a subscription of the topic. For more samples on other and advanced scenarios, see [Service Bus .NET samples on GitHub](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus/samples).
265
268
266
269
### Create a project for the receiver
267
270
@@ -307,6 +310,7 @@ In this section, you add code to retrieve messages from the subscription.
307
310
1. Replace the existing contents of `Program.cs` with the following properties and methods:
308
311
309
312
313
+
310
314
## [Passwordless](#tab/passwordless)
311
315
312
316
```csharp
@@ -341,6 +345,9 @@ In this section, you add code to retrieve messages from the subscription.
341
345
342
346
## [Connection String](#tab/connection-string)
343
347
348
+
> [!IMPORTANT]
349
+
> Update placeholder values (`<TOPIC-SUBSCRIPTION-NAME>`) in the code snippet with names of the topic and the subscription.
350
+
344
351
```csharp
345
352
using System.Threading.Tasks;
346
353
using Azure.Messaging.ServiceBus;
@@ -654,7 +661,7 @@ In this section, you add code to retrieve messages from the subscription.
654
661
655
662
656
663
657
-
## Next steps
664
+
## Related content
658
665
See the following documentation and samples:
659
666
660
667
- [Azure Service Bus client library for .NET - Readme](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/servicebus/Azure.Messaging.ServiceBus)
0 commit comments