Skip to content

Commit 9f3a792

Browse files
committed
Queue quickstart is ready
1 parent 88c9aeb commit 9f3a792

File tree

4 files changed

+47
-27
lines changed

4 files changed

+47
-27
lines changed
Loading

articles/service-bus-messaging/service-bus-dotnet-get-started-with-queues.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Quickstart - Use Azure Service Bus queues from .NET app
33
description: This quickstart shows you how to send messages to and receive messages from Azure Service Bus queues using the .NET programming language.
44
ms.topic: quickstart
55
ms.tgt_pltfrm: dotnet
6-
ms.date: 11/08/2022
6+
ms.date: 11/10/2022
77
ms.devlang: csharp
88
ms.custom: contperf-fy22q2, mode-api
99
---
@@ -37,20 +37,18 @@ If you're new to the service, see [Service Bus overview](service-bus-messaging-o
3737

3838
[!INCLUDE [service-bus-create-queue-portal](./includes/service-bus-create-queue-portal.md)]
3939

40-
4140
[!INCLUDE [service-bus-passwordless-template-tabbed](../../includes/passwordless/service-bus/service-bus-passwordless-template-tabbed.md)]
4241

4342
## Launch Visual Studio and sign-in to Azure
4443

4544
You can authorize access to the service bus namespace using the following steps:
4645

47-
Select the **Sign in** button in the top right of Visual Studio.
48-
49-
:::image type="content" source="..//storage/blobs/media/storage-quickstart-blobs-dotnet/sign-in-visual-studio-small.png" alt-text="Screenshot showing the button to sign in to Azure using Visual Studio.":::
46+
1. Select the **Sign in** button in the top right of Visual Studio.
5047

51-
Sign-in using the Azure AD account you assigned a role to previously.
48+
:::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.":::
49+
2. Sign-in using the Azure AD account you assigned a role to previously.
5250

53-
:::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+
:::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.":::
5452

5553

5654
## Send messages to the queue
@@ -62,12 +60,11 @@ This section shows you how to create a .NET console application to send messages
6260
6361
### Create a console application
6462

65-
1. Start Visual Studio 2022.
66-
1. Select **Create a new project**.
63+
1. In Visual Studio, select **File** -> **New** -> **Project** menu.
6764
1. On the **Create a new project** dialog box, do the following steps: If you don't see this dialog box, select **File** on the menu, select **New**, and then select **Project**.
6865
1. Select **C#** for the programming language.
6966
1. Select **Console** for the type of the application.
70-
1. Select **Console Application** from the results list.
67+
1. Select **Console App** from the results list.
7168
1. Then, select **Next**.
7269

7370
:::image type="content" source="./media/service-bus-dotnet-get-started-with-queues/new-send-project.png" alt-text="Image showing the Create a new project dialog box with C# and Console selected":::
@@ -81,10 +78,14 @@ This section shows you how to create a .NET console application to send messages
8178
### [Passwordless](#tab/passwordless)
8279

8380
1. Select **Tools** > **NuGet Package Manager** > **Package Manager Console** from the menu.
84-
1. Run the following command to install the **Azure.Messaging.ServiceBus** and **Azure.Identity** NuGet packages:
81+
1. Run the following command to install the **Azure.Messaging.ServiceBus** NuGet package.
8582

8683
```powershell
8784
Install-Package Azure.Messaging.ServiceBus
85+
```
86+
1. Run the following command to install the **Azure.Identity** NuGet package.
87+
88+
```powershell
8889
Install-Package Azure.Identity
8990
```
9091
@@ -108,9 +109,9 @@ This section shows you how to create a .NET console application to send messages
108109
### [Passwordless](#tab/passwordless)
109110
110111
> [!IMPORTANT]
111-
> Per the `TODO` comment, update the placeholder values in the code snippets with the values from the Service Bus you created.
112+
> As per the `TODO` comment in the source code, update the placeholder values (`<NAMESPACE-NAME>` and `<QUEUE-NAME>`) in the code snippet with the values from the Service Bus you created.
112113
113-
* Creates a [ServiceBusClient](/dotnet/api/azure.messaging.servicebus.servicebusclient) object using the passwordless `DefaultAzureCredential` object. `DefaultAzureCredential` will automatically discover and use the credentials of your Visual Studio login to authenticate to Azure Service Bus.
114+
* Creates a [ServiceBusClient](/dotnet/api/azure.messaging.servicebus.servicebusclient) object using the `DefaultAzureCredential` object. `DefaultAzureCredential` will automatically discover and use the credentials of your Visual Studio login to authenticate to Azure Service Bus.
114115
* Invokes the [CreateSender](/dotnet/api/azure.messaging.servicebus.servicebusclient.createsender) method on the [ServiceBusClient](/dotnet/api/azure.messaging.servicebus.servicebusclient) object to create a [ServiceBusSender](/dotnet/api/azure.messaging.servicebus.servicebussender) object for the specific Service Bus queue.
115116
* Creates a [ServiceBusMessageBatch](/dotnet/api/azure.messaging.servicebus.servicebusmessagebatch) object by using the [ServiceBusSender.CreateMessageBatchAsync](/dotnet/api/azure.messaging.servicebus.servicebussender.createmessagebatchasync) method.
116117
* Add messages to the batch using the [ServiceBusMessageBatch.TryAddMessage](/dotnet/api/azure.messaging.servicebus.servicebusmessagebatch.tryaddmessage).
@@ -290,14 +291,19 @@ In this section, you'll create a .NET console application that receives messages
290291
### [Passwordless](#tab/passwordless)
291292
292293
1. Select **Tools** > **NuGet Package Manager** > **Package Manager Console** from the menu.
293-
1. Run the following command to install the **Azure.Messaging.ServiceBus** and **Azure.Identity** NuGet packages:
294+
1. Select **QueueReceiver** for **Default project**.
295+
296+
:::image type="content" source="media/service-bus-dotnet-get-started-with-queues/package-manager-console.png" alt-text="Screenshot showing QueueReceiver project selected in the Package Manager Console.":::
297+
1. Run the following command to install the **Azure.Messaging.ServiceBus** NuGet package.
294298
295299
```powershell
296300
Install-Package Azure.Messaging.ServiceBus
297-
Install-Package Azure.Identity
298301
```
302+
1. Run the following command to install the **Azure.Identity** NuGet package.
299303
300-
:::image type="content" source="media/service-bus-dotnet-get-started-with-queues/package-manager-console.png" alt-text="Screenshot showing QueueReceiver project selected in the Package Manager Console.":::
304+
```powershell
305+
Install-Package Azure.Identity
306+
```
301307
302308
### [Connection String](#tab/connection-string)
303309
@@ -380,6 +386,8 @@ In this section, you'll add code to retrieve messages from the queue.
380386
* Starts processing messages by invoking the [StartProcessingAsync](/dotnet/api/azure.messaging.servicebus.servicebusprocessor.startprocessingasync) on the `ServiceBusProcessor` object.
381387
* When user presses a key to end the processing, invokes the [StopProcessingAsync](/dotnet/api/azure.messaging.servicebus.servicebusprocessor.stopprocessingasync) on the `ServiceBusProcessor` object.
382388
389+
> [!IMPORTANT]
390+
> Update placeholder values (`<NAMESPACE-NAME>` and `<QUEUE-NAME>`) in the code snippet with actual values you noted down earlier..
383391
384392
```csharp
385393
// The Service Bus client types are safe to cache and use as a singleton for the lifetime
4.48 KB
Loading

includes/passwordless/service-bus/service-bus-assign-roles.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,42 @@ The following example assigns the `Azure Service Bus Data Owner` role to your us
1717
### Azure built-in roles for Azure Service Bus
1818
For Azure Service Bus, the management of namespaces and all related resources through the Azure portal and the Azure resource management API is already protected using the Azure RBAC model. Azure provides the below Azure built-in roles for authorizing access to a Service Bus namespace:
1919

20-
- [Azure Service Bus Data Owner](../../../articles/role-based-access-control/built-in-roles.md#azure-service-bus-data-owner): Enables data access to Service Bus namespace and its entities (queues, topics, subscriptions, and filters)
20+
- [Azure Service Bus Data Owner](../../../articles/role-based-access-control/built-in-roles.md#azure-service-bus-data-owner): Enables data access to Service Bus namespace and its entities (queues, topics, subscriptions, and filters). A member of this role can send and receive messages from queues or topics/subscriptions.
2121
- [Azure Service Bus Data Sender](../../../articles/role-based-access-control/built-in-roles.md#azure-service-bus-data-sender): Use this role to give the send access to Service Bus namespace and its entities.
2222
- [Azure Service Bus Data Receiver](../../../articles/role-based-access-control/built-in-roles.md#azure-service-bus-data-receiver): Use this role to give the receive access to Service Bus namespace and its entities.
2323

2424
If you want to create a custom role, see [Rights required for Service Bus operations](../../../articles/service-bus-messaging/service-bus-sas.md#rights-required-for-service-bus-operations).
2525

26+
### Create a user in Azure Active Directory
27+
28+
If you are already have an Azure Active Directory (Azure AD) user account, skip this step. If not (for example, if you logged in using a Microsoft account like: `[email protected]`), create a user in Azure AD.
29+
30+
1. Sign-in to [Azure portal](https://portal.azure.com) in a new tab or new web browser window.
31+
1. In the search bar at the top, type **Azure Active Directory**, and select **Azure Active Directory** from the results.
32+
1. On the Azure Active Directory page, select **Users** under **Manage** on the left navigational menu.
33+
1. On the **Users** page, select **+ New user** on the command bar, and then select **Create new user**.
34+
1. On the **New user** page, follow these steps:
35+
1. For **User name**, enter a name for the user. For example: **john.doe**.
36+
1. For **Name**, specify the full name. For example: **John Doe**.
37+
1. Select **Create** to create the user in Azure AD.
38+
39+
### Add Azure AD user to Azure Service Bus Owner role
40+
41+
Add your Azure AD user name or the one you created in the previous step to the **Azure Service Bus Data Owner** role at the Service Bus namespace level. It will allow an app running in the context of this user account to send messages to a queue or a topic, and receive messages from a queue or a topic's subscription.
42+
2643
> [!IMPORTANT]
2744
> In most cases, it will take a minute or two for the role assignment to propagate in Azure. In rare cases, it may take up to eight minutes. If you receive authentication errors when you first run your code, wait a few moments and try again.
2845
29-
1. In the Azure portal, locate your service bus namespace using the main search bar or left navigation.
30-
46+
1. If you don't have the Service Bus Namespace page open in the Azure portal, locate your Service Bus namespace using the main search bar or left navigation.
3147
2. On the overview page, select **Access control (IAM)** from the left-hand menu.
32-
3348
3. On the **Access control (IAM)** page, select the **Role assignments** tab.
34-
3549
4. Select **+ Add** from the top menu and then **Add role assignment** from the resulting drop-down menu.
3650

3751
:::image type="content" source="media/service-bus-assign-roles/add-role.png" alt-text="A screenshot showing how to assign a role.":::
38-
3952
5. Use the search box to filter the results to the desired role. For this example, search for `Azure Service Bus Data Owner` and select the matching result. Then choose **Next**.
53+
1. Under **Assign access to**, select **User, group, or service principal**, and then choose **+ Select members**.
4054

41-
6. Under **Assign access to**, select **User, group, or service principal**, and then choose **+ Select members**.
42-
43-
7. In the dialog, search for your Azure AD username (usually your *user@domain* email address) and then choose **Select** at the bottom of the dialog.
44-
45-
8. Select **Review + assign** to go to the final page, and then **Review + assign** again to complete the process.
55+
56+
1. In the dialog, search for your Azure AD username (usually your *user@domain* email address) and then choose **Select** at the bottom of the dialog.
57+
1. Select **Review + assign** to go to the final page, and then **Review + assign** again to complete the process.
4658

0 commit comments

Comments
 (0)