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/event-hubs/authenticate-shared-access-signature.md
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,23 @@
1
1
---
2
-
title: Authenticate access to Azure Event Hubs with shared access signatures
3
-
description: This article shows you how to authenticate access to Event Hubs resources using shared access signatures.
2
+
title: "SAS Authentication for Azure Event Hubs Resources"
3
+
description: Learn how to authenticate access to Azure Event Hubs resources using shared access signatures (SAS). Get granular control over permissions and security. Includes code examples in C#, Java, and Node.js to implement SAS authentication.
4
+
#customer intent: Based on the content you've provided about SAS authentication for Azure Event Hubs, here are 10 customer intent statements following the agile user story format:
4
5
ms.topic: conceptual
5
-
ms.date: 06/25/2024
6
+
ms.date: 07/25/2025
6
7
ms.devlang: csharp
7
-
# ms.devlang: csharp, java, javascript, php
8
-
ms.custom: devx-track-csharp
8
+
ms.custom:
9
+
- devx-track-csharp
10
+
- ai-gen-docs-bap
11
+
- ai-gen-title
12
+
- ai-seo-date:07/25/2025
13
+
- ai-gen-description
9
14
---
10
15
11
16
# Authenticate access to Event Hubs resources using shared access signatures (SAS)
12
17
Shared access signature (SAS) gives you granular control over the type of access you grant to the clients. Here are some of the controls you can set in a SAS:
13
18
14
19
- The interval over which the SAS is valid, which includes the start time and expiry time.
15
-
- The permissions granted by the SAS. For example, a SAS for an Event Hubs namespace might grant the listen permission, but not the send permission.
20
+
- The permissions granted by the SAS. For example, a SAS for an Event Hubs namespace might grant the permission to listen for event, but not the permission to send events.
16
21
- Only clients that present valid credentials can send data to an event hub.
17
22
- A client can't impersonate another client.
18
23
- A rogue client can be blocked from sending data to an event hub.
@@ -50,7 +55,7 @@ The signature-string is the SHA-256 hash computed over the resource URI (scope a
The token contains the non-hashed values so that the recipient can recompute the hash with the same parameters, verifying that the issuer is in possession of a valid signing key.
58
+
The token contains the nonhashed values so that the recipient can recompute the hash with the same parameters, verifying that the issuer is in possession of a valid signing key.
54
59
55
60
The resource URI is the full URI of the Service Bus resource to which access is claimed. For example, `http://<namespace>.servicebus.windows.net/<entityPath>` or `sb://<namespace>.servicebus.windows.net/<entityPath>` that is, `http://contoso.servicebus.windows.net/eh1`.
56
61
@@ -237,7 +242,7 @@ An event publisher defines a virtual endpoint for an event hub. The publisher ca
237
242
238
243
Typically, an event hub employs one publisher per client. All messages that are sent to any of the publishers of an event hub are enqueued within that event hub. Publishers enable fine-grained access control.
239
244
240
-
Each Event Hubs client is assigned a unique token, which is uploaded to the client. The tokens are produced such that each unique token grants access to different unique publisher. A client that holds a token can only send to one publisher, and no other publisher. If multiple clients share the same token, then each of them shares the publisher.
245
+
A unique token is assigned to each Event Hubs client, which is uploaded to the client. The tokens are produced such that each unique token grants access to different unique publisher. A client that holds a token can only send to one publisher, and no other publisher. If multiple clients share the same token, then each of them shares the publisher.
241
246
242
247
All tokens are assigned with SAS keys. Typically, all tokens are signed with the same key. Clients aren't aware of the key, which prevents clients from manufacturing tokens. Clients operate on the same tokens until they expire.
243
248
@@ -251,20 +256,20 @@ For example, to define authorization rules scoped down to only sending/publishin
251
256
252
257
253
258
> [!NOTE]
254
-
> Although we don't recommend it, it's possible to equip devices with tokens that grant access to an event hub or a namespace. Any device that holds this token can send messages directly to that event hub. Furthermore, the device cannot be blocklisted from sending to that event hub.
259
+
> Although we don't recommend it, it's possible to equip devices with tokens that grant access to an event hub or a namespace. Any device that holds this token can send messages directly to that event hub. Furthermore, the device can't be blocklisted from sending to that event hub.
255
260
>
256
261
> We recommend that you give specific and granular scopes.
257
262
258
263
> [!IMPORTANT]
259
-
> Once the tokens have been created, each client is provisioned with its own unique token.
264
+
> Once the tokens are created, each client is provisioned with its own unique token.
260
265
>
261
266
> When the client sends data into an event hub, it tags its request with the token. To prevent an attacker from eavesdropping and stealing the token, the communication between the client and the event hub must occur over an encrypted channel.
262
267
>
263
-
> If a token is stolen by an attacker, the attacker can impersonate the client whose token has been stolen. Blocklisting a publisher, renders that client unusable until it receives a new token that uses a different publisher.
268
+
> If an attacker steals a token, the attacker can impersonate the client whose token has been stolen. Disallowing a publisher, renders that client unusable until it receives a new token that uses a different publisher.
264
269
265
270
266
271
## Authenticating Event Hubs consumers with SAS
267
-
To authenticate back-end applications that consume from the data generated by Event Hubs producers, Event Hubs token authentication requires its clients to either have the **manage** rights or the **listen** privileges assigned to its Event Hubs namespace or event hub instance or topic. Data is consumed from Event Hubs using consumer groups. While SAS policy gives you granular scope, this scope is defined only at the entity level and not at the consumer level. It means that the privileges defined at the namespace level or the event hub or topic level are applied to the consumer groups of that entity.
272
+
To authenticate back-end applications that consume data generated by Event Hubs producers, Event Hubs token authentication requires its clients to have either the **manage** rights or the **listen** privileges assigned to its Event Hubs namespace or event hub instance or topic. Data is consumed from Event Hubs using consumer groups. While SAS policy gives you granular scope, this scope is defined only at the entity level and not at the consumer level. It means that the privileges defined at the namespace level or the event hub or topic level are applied to the consumer groups of that entity.
268
273
269
274
## Disable local/SAS Key authentication
270
275
For certain organizational security requirements, you want to disable local/SAS key authentication completely and rely on the Microsoft Entra ID based authentication, which is the recommended way to connect with Azure Event Hubs. You can disable local/SAS key authentication at the Event Hubs namespace level using Azure portal or Azure Resource Manager template.
@@ -333,15 +338,10 @@ You can disable local authentication for a given Event Hubs namespace by setting
333
338
- See the .NET sample #5 in [this GitHub location](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/eventhub/Azure.Messaging.EventHubs.Processor/samples) to learn how to consume or process events using shared access credentials or the default Azure credential identity.
334
339
335
340
## Next steps
336
-
See the following articles:
337
341
338
-
- [Authorize using SAS](authenticate-shared-access-signature.md)
339
-
- [Authorize using Azure role-based access control (RBAC)](authorize-access-azure-active-directory.md)
340
-
- [Learn more about Event Hubs](event-hubs-about.md)
342
+
Now that you understand SAS authentication, explore these related topics:
0 commit comments