Skip to content

Commit 2e920e4

Browse files
Merge pull request #226789 from spelluru/ehubsample0208
updated list of samples
2 parents 7b7bdd9 + 47efcc1 commit 2e920e4

File tree

3 files changed

+28
-23
lines changed

3 files changed

+28
-23
lines changed

articles/event-hubs/authenticate-application.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Authenticate an application to access Azure Event Hubs resources
33
description: This article provides information about authenticating an application with Azure Active Directory to access Azure Event Hubs resources
44
ms.topic: conceptual
5-
ms.date: 11/08/2022
5+
ms.date: 02/08/2023
66
ms.custom: subject-rbac-steps
77
---
88

@@ -64,13 +64,10 @@ Once you've registered your application and granted it permissions to send/recei
6464
For scenarios where acquiring tokens is supported, see the [Scenarios](https://aka.ms/msal-net-scenarios) section of the [Microsoft Authentication Library (MSAL) for .NET](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet) GitHub repository.
6565

6666
## Samples
67-
- [Azure.Messaging.EventHubs samples](https://github.com/Azure/azure-event-hubs/tree/master/samples/DotNet/Azure.Messaging.EventHubs/ManagedIdentityWebApp)
68-
69-
This sample has been updated to use the latest **Azure.Messaging.EventHubs** library.
70-
- [Microsoft.Azure.EventHubs samples](https://github.com/Azure/azure-event-hubs/tree/master/samples/DotNet/Microsoft.Azure.EventHubs/Rbac).
67+
- [RBAC samples using the latest .NET Azure.Messaging.EventHubs package](https://github.com/Azure/azure-event-hubs/tree/master/samples/DotNet/Microsoft.Azure.EventHubs/Rbac)
68+
- [RBAC samples using the legacy .NET Microsoft.Azure.EventHubs package](https://github.com/Azure/azure-event-hubs/tree/master/samples/DotNet/Microsoft.Azure.EventHubs/Rbac).
69+
- [RBAC sample using the legacy Java com.microsoft.azure.eventhubs package](https://github.com/Azure/azure-event-hubs/tree/master/samples/Java/Rbac). You can use the [migration guide](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/eventhubs/azure-messaging-eventhubs/migration-guide.md) to migrate this sample to use the new package (`com.azure.messaging.eventhubs`). To learn more about using the new package in general, see samples [here](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs).
7170

72-
These samples use the old **Microsoft.Azure.EventHubs** library, but you can easily update it to using the latest **Azure.Messaging.EventHubs** library. To move the sample from using the old library to new one, see the [Guide to migrate from Microsoft.Azure.EventHubs to Azure.Messaging.EventHubs](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/eventhub/Azure.Messaging.EventHubs/MigrationGuide.md).
73-
7471

7572
## Next steps
7673
- To learn more about Azure RBAC, see [What is Azure role-based access control (Azure RBAC)](../role-based-access-control/overview.md)?

articles/event-hubs/authenticate-managed-identity.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Authentication a managed identity with Azure Active Directory
33
description: This article provides information about authenticating a managed identity with Azure Active Directory to access Azure Event Hubs resources
44
ms.topic: conceptual
5-
ms.date: 12/15/2022
5+
ms.date: 02/08/2023
66
ms.custom: subject-rbac-steps
77
---
88

@@ -118,14 +118,17 @@ var ehClient = EventHubClient.CreateWithManagedIdentity(new Uri($"sb://{EventHub
118118
You can use Apache Kafka applications to send messages to and receive messages from Azure Event Hubs using managed identity OAuth. See the following sample on GitHub: [Event Hubs for Kafka - send and receive messages using managed identity OAuth](https://github.com/Azure/azure-event-hubs-for-kafka/tree/master/tutorials/oauth/java/managedidentity).
119119

120120
## Samples
121-
- **Azure.Messaging.EventHubs** samples
122-
- [.NET](https://github.com/Azure/azure-event-hubs/tree/master/samples/DotNet/Azure.Messaging.EventHubs/ManagedIdentityWebApp)
123-
- [Java](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs)
124-
- [Microsoft.Azure.EventHubs samples](https://github.com/Azure/azure-event-hubs/tree/master/samples/DotNet/Microsoft.Azure.EventHubs/Rbac).
125-
126-
These samples use the old **Microsoft.Azure.EventHubs** library, but you can easily update it to using the latest **Azure.Messaging.EventHubs** library. To move the sample from using the old library to new one, see the [Guide to migrate from Microsoft.Azure.EventHubs to Azure.Messaging.EventHubs](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/eventhub/Azure.Messaging.EventHubs/MigrationGuide.md).
127-
This sample has been updated to use the latest **Azure.Messaging.EventHubs** library.
128-
- [Event Hubs for Kafka - send and receive messages using managed identity OAuth](https://github.com/Azure/azure-event-hubs-for-kafka/tree/master/tutorials/oauth/java/managedidentity)
121+
122+
- .NET.
123+
- For a sample that uses the latest **Azure.Messaging.EventHubs** package, see [Publish events with a managed identity](https://github.com/Azure/azure-event-hubs/tree/master/samples/DotNet/Azure.Messaging.EventHubs/ManagedIdentityWebApp)
124+
- For a sample that uses the legacy **Microsoft.Azure.EventHubs** package, see [this .NET sample on GitHub](https://github.com/Azure/azure-event-hubs/tree/master/samples/DotNet/Microsoft.Azure.EventHubs/Rbac/ManagedIdentityWebApp)
125+
- Java - see the following samples.
126+
- **Publish events with Azure identity** sample on [GitHub](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs).
127+
- To learn how to use the Apache Kafka protocol to send events to and receive events from an event hub using a managed identity, see [Event Hubs for Kafka sample to send and receive messages using a managed identity](https://github.com/Azure/azure-event-hubs-for-kafka/tree/master/tutorials/oauth/java/managedidentity).
128+
129+
130+
.
131+
129132

130133

131134
## Next steps

articles/event-hubs/authenticate-shared-access-signature.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.custom: devx-track-js, devx-track-csharp
99
# Authenticate access to Event Hubs resources using shared access signatures (SAS)
1010
Shared access signature (SAS) gives you granular control over the type of access you grant to the clients who has the shared access signature. Here are some of the controls you can set in a SAS:
1111

12-
- The interval over which the SAS is valid, including the start time and expiry time.
12+
- The interval over which the SAS is valid, which includes the start time and expiry time.
1313
- 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.
1414
- Only clients that present valid credentials can send data to an event hub.
1515
- A client can't impersonate another client.
@@ -24,7 +24,7 @@ This article covers authenticating the access to Event Hubs resources using SAS.
2424
2525

2626
## Configuring for SAS authentication
27-
You can configure the EventHubs shared access authorization rule on an Event Hubs namespace, or an entity (event hub instance or Kafka Topic in an event hub). Configuring a shared access authorization rule on a consumer group is currently not supported, but you can use rules configured on a namespace or entity to secure access to consumer group.
27+
You can configure a shared access authorization rule on an Event Hubs namespace, or an entity (event hub instance or Kafka Topic in an event hub). Configuring a shared access authorization rule on a consumer group is currently not supported, but you can use rules configured on a namespace or entity to secure access to consumer group.
2828

2929
The following image shows how the authorization rules apply on sample entities.
3030

@@ -34,13 +34,13 @@ In this example, the sample Event Hubs namespace (ExampleNamespace) has two enti
3434

3535
The manageRuleNS, sendRuleNS, and listenRuleNS authorization rules apply to both event hub instance eh1 and topic t1. The listenRule-eh and sendRule-eh authorization rules apply only to event hub instance eh1 and sendRuleT authorization rule applies only to topic topic1.
3636

37-
When using sendRuleNS authorization rule, client applications can send to both eh1 and topic1. When sendRuleT authorization rule is used, it enforces granular access to topic1 only and hence client applications using this rule for access now cannot send to eh1, but only to topic1.
37+
When you use sendRuleNS authorization rule, client applications can send to both eh1 and topic1. When sendRuleT authorization rule is used, it enforces granular access to topic1 only and hence client applications using this rule for access now can't send to eh1, but only to topic1.
3838

3939
## Generate a Shared Access Signature token
4040
Any client that has access to name of an authorization rule name and one of its signing keys can generate a SAS token. The token is generated by crafting a string in the following format:
4141

4242
- `se` – Token expiry instant. Integer reflecting seconds since epoch 00:00:00 UTC on 1 January 1970 (UNIX epoch) when the token expires
43-
- `skn` – Name of the authorization rule, that is the SAS key name.
43+
- `skn` – Name of the authorization rule, which is the SAS key name.
4444
- `sr` – URI of the resource being accessed.
4545
- `sig` – Signature.
4646

@@ -92,7 +92,7 @@ To use a policy name and a key value to connect to an event hub, use the `EventH
9292
const producer = new EventHubProducerClient("NAMESPACE NAME.servicebus.windows.net", eventHubName, new AzureNamedKeyCredential("POLICYNAME", "KEYVALUE"));
9393
```
9494

95-
You'll need to add a reference to `AzureNamedKeyCredential`.
95+
You need to add a reference to `AzureNamedKeyCredential`.
9696

9797
```javascript
9898
const { AzureNamedKeyCredential } = require("@azure/core-auth");
@@ -105,7 +105,7 @@ var token = createSharedAccessToken("https://NAMESPACENAME.servicebus.windows.ne
105105
const producer = new EventHubProducerClient("NAMESPACENAME.servicebus.windows.net", eventHubName, new AzureSASCredential(token));
106106
```
107107

108-
You'll need to add a reference to `AzureSASCredential`.
108+
You need to add a reference to `AzureSASCredential`.
109109

110110
```javascript
111111
const { AzureSASCredential } = require("@azure/core-auth");
@@ -269,7 +269,7 @@ For example, to define authorization rules scoped down to only sending/publishin
269269
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 instance or topic level will be applied to the consumer groups of that entity.
270270

271271
## Disabling Local/SAS Key authentication
272-
For certain organizational security requirements, you may have to disable local/SAS key authentication completely and rely on the Azure Active Directory (Azure AD) 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.
272+
For certain organizational security requirements, you may have to disable local/SAS key authentication completely and rely on the Azure Active Directory (Azure AD) 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.
273273

274274
### Disabling Local/SAS Key authentication via the portal
275275
You can disable local/SAS key authentication for a given Event Hubs namespace using the Azure portal.
@@ -328,6 +328,11 @@ You can disable local authentication for a given Event Hubs namespace by setting
328328
]
329329
```
330330

331+
## Samples
332+
333+
- See the .NET sample #6 in [this GitHub location](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/eventhub/Azure.Messaging.EventHubs/samples) to learn how to publish events to an event hub using shared access credentials or the default Azure credential identity.
334+
- 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.
335+
331336
## Next steps
332337
See the following articles:
333338

0 commit comments

Comments
 (0)