Skip to content

Commit 70c3050

Browse files
Merge pull request #279479 from spelluru/sbusfeedback0627
Feedback from the Service Bus product team
2 parents 8444434 + ef9df98 commit 70c3050

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

articles/service-bus-messaging/service-bus-authentication-and-authorization.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This article gives you details on using these two types of security mechanisms.
1616
<a name='azure-active-directory'></a>
1717

1818
## Microsoft Entra ID
19-
Microsoft Entra integration with Service Bus provides role-based access control (RBAC) to Service Bus resources. You can use Azure RBAC to grant permissions to a security principal, which can be a user, a group, an application service principal, or a managed identity. Microsoft Entra authenticates the security principal and returns an OAuth 2.0 token. This token can be used to authorize a request to access a Service Bus resource (queue, topic, and so on).
19+
Microsoft Entra integration with Service Bus provides role-based access control (RBAC) to Service Bus resources. You can use Azure RBAC to grant permissions to a security principal, which can be a user, a group, an application service principal, or a managed identity. Microsoft Entra authenticates the security principal and returns an OAuth 2.0 token. This token can be used to authorize a request to access a Service Bus resource (queue, topic, and subscription).
2020

2121
For more information about authenticating with Microsoft Entra ID, see the following articles:
2222

@@ -34,7 +34,7 @@ For more information about authenticating with Microsoft Entra ID, see the follo
3434
## Shared access signature
3535
[SAS authentication](service-bus-sas.md) enables you to grant a user access to Service Bus resources, with specific rights. SAS authentication in Service Bus involves the configuration of a cryptographic key with associated rights on a Service Bus resource. Clients can then gain access to that resource by presenting a SAS token, which consists of the resource URI being accessed and an expiry signed with the configured key.
3636

37-
You can configure keys for SAS on a Service Bus namespace. The key applies to all messaging entities within that namespace. You can also configure keys on Service Bus queues and topics. To use SAS, you can configure a shared access authorization rule on a namespace, queue, or topic. This rule consists of the following elements:
37+
You can configure shared access policies on a Service Bus namespace. The key applies to all messaging entities within that namespace. You can also configure shared access policies on Service Bus queues and topics. To use SAS, you can configure a shared access authorization rule on a namespace, queue, or topic. This rule consists of the following elements:
3838

3939
* **KeyName**: identifies the rule.
4040
* **PrimaryKey**: a cryptographic key used to sign/validate SAS tokens.
@@ -45,10 +45,12 @@ Authorization rules configured at the namespace level can grant access to all en
4545

4646
To access an entity, the client requires a SAS token generated using a specific shared access authorization rule. The SAS token is generated using the HMAC-SHA256 of a resource string that consists of the resource URI to which access is claimed, and an expiry with a cryptographic key associated with the authorization rule.
4747

48-
SAS authentication support for Service Bus is included in the Azure .NET SDK versions 2.0 and later. SAS includes support for a shared access authorization rule. All APIs that accept a connection string as a parameter include support for SAS connection strings.
48+
SAS authentication support for Service Bus is included in the Azure .NET SDK versions 2.0 and later. SAS includes support for a shared access authorization rule. All APIs that accept a connection string as a parameter include support for SAS connection strings.
4949

50+
For detailed information on using SAS for authentication, see [Authentication with Shared Access Signatures](service-bus-sas.md).
5051

51-
## Next steps
52+
53+
## Related content
5254
For more information about authenticating with Microsoft Entra ID, see the following articles:
5355

5456
- [Authentication with managed identities](service-bus-managed-service-identity.md)

articles/service-bus-messaging/service-bus-managed-service-identity.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,22 @@ Here are the high-level steps to use a managed identity to access a Service Bus
1414
- [Configure managed identities for App Service and Azure Functions](../app-service/overview-managed-identity.md)
1515
- [Configure managed identities for Azure resources on a VM](../active-directory/managed-identities-azure-resources/qs-configure-portal-windows-vm.md)
1616
1. Assign Azure Service Bus Data Owner, Azure Service Bus Data Sender, or Azure Service Bus Data Receiver role to the managed identity at the appropriate scope (Azure subscription, resource group, Service Bus namespace, or Service Bus queue or topic). For instructions to assign a role to a managed identity, see [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.yml).
17-
1. In your application, use the managed identity and the endpoint to Service Bus namespace to connect to the namespace. For example, in .NET, you use the [ServiceBusClient](/dotnet/api/azure.messaging.servicebus.servicebusclient.-ctor#azure-messaging-servicebus-servicebusclient-ctor(system-string-azure-core-tokencredential)) constructor that takes `TokenCredential` and `fullyQualifiedNamespace` (a string, for example: `cotosons.servicebus.windows.net`) parameters to connect to Service Bus using the managed identity. You pass in [DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential), which derives from `TokenCredential` and uses the managed identity.
17+
1. In your application, use the managed identity and the endpoint to Service Bus namespace to connect to the namespace.
18+
19+
For example, in .NET, you use the [ServiceBusClient](/dotnet/api/azure.messaging.servicebus.servicebusclient.-ctor#azure-messaging-servicebus-servicebusclient-ctor(system-string-azure-core-tokencredential)) constructor that takes `TokenCredential` and `fullyQualifiedNamespace` (a string, for example: `cotosons.servicebus.windows.net`) parameters to connect to Service Bus using the managed identity. You pass in [DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential), which derives from `TokenCredential` and uses the managed identity. In `DefaultAzureCredentialOptions`, set the `ManagedIdentityClientId` to the ID of client's managed identity.
20+
21+
```csharp
22+
string fullyQualifiedNamespace = "<your Namespace>.servicebus.windows.net>";
23+
string userAssignedClientId = "<your managed identity client ID>";
24+
25+
var credential = new DefaultAzureCredential(
26+
new DefaultAzureCredentialOptions
27+
{
28+
ManagedIdentityClientId = userAssignedClientId
29+
});
30+
31+
var sbusClient = new ServiceBusClient(fullyQualifiedNamespace, credential);
32+
```
1833

1934
> [!IMPORTANT]
2035
> You can disable local or SAS key authentication for a Service Bus namespace and allow only Microsoft Entra authentication. For step-by-step instructions, see [Disable local authentication](disable-local-authentication.md).

0 commit comments

Comments
 (0)