This commit is contained in:
Lily Ma 2021-03-22 17:07:43 -07:00 коммит произвёл Serkant Karaca
Родитель b2cf08e26f
Коммит 903add4061
27 изменённых файлов: 26 добавлений и 24 удалений

Просмотреть файл

@ -52,7 +52,7 @@ For more information on creating a Service Principal, refer to the following art
The Geo DR actions could be
* CreatePairing
For creating a paired region. After this, you should see metadata (i.e. event hubs, consumer groups, throughput units etc. replicated to the secondary namespace).
For creating a paired region. After this, you should see metadata (i.e. Event Hubs, consumer groups, throughput units etc. replicated to the secondary namespace).
* FailOver
Simulating a failover. After this action, the secondary namespace becomes the primary
@ -64,7 +64,7 @@ For breaking the pairing between a primary and secondary namespace
For deleting an alias, that contains information about the primary-secondary pairing
* GetConnectionStrings
In a Geo DR enabled namespace, the Event Hubs should be accessed only via the alias. This is because, the alias can point to either the primary event hub or the failed over event hub. This way, the user does not have to adjust the connection strings in his/her apps to point to a different event hub in the case of a failover.
In a Geo DR enabled namespace, the Event Hubs should be accessed only via the alias. This is because, the alias can point to either the primary Event Hub or the failed over Event Hub. This way, the user does not have to adjust the connection strings in his/her apps to point to a different Event Hub in the case of a failover.
Examples
* EventHubsGeoDRManagementSample.exe CreatePairing GeoDRSampleConfig.json
@ -86,7 +86,7 @@ The following section describes the steps for performing Geo-diaster recovery,
d. Changing the names of an alias is not allowed.
e. Changing the secondary namespace is not allowed.
3. Create an alias and provide the primary and secondary namespaces to complete the pairing.
4. Get the required connection strings on the alias to connect to your event hubs.
4. Get the required connection strings on the alias to connect to your Event Hubs.
5. Once the namespaces are paired with an alias, the metadata is replicated periodically in both namespaces.
**Note:** Creating a pairing, failing over, breaking the pairing, deleting the alias have all retries build in. All before mentioned operations will retry 10 times with 10 minutes in between each attempt.
@ -95,7 +95,7 @@ The following section describes the steps for performing Geo-diaster recovery,
After this step, the seconday namespace becomes the primary namespace.
1. Initiate a fail-over. This step is only performed on the secondary namespace. The geo-pairing is broken and the alias now points to the secondary namespace. **Note:** The Failover can take a few minutes to complete.
2. Senders and receivers still connect to the event hubs using the alias. The failover does not disrupt the connection.
2. Senders and receivers still connect to the Event Hubs using the alias. The failover does not disrupt the connection.
3. Because the pairing is broken, the old primary namespace no longer has a replication status associated with it.
4. The metadata synchronization between the primary and secondary namespaces also stops

Просмотреть файл

@ -2,6 +2,9 @@
For more information on Role based access (RBAC) and how to run this sample follow [this](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-role-based-access-control) link.
**Note**: This sample uses the legacy Event Hubs library `Microsoft.Azure.EventHubs`. We strongly recommend you to use the new library `Azure.Messaging.EventHubs`.
**Note**: This sample uses the legacy Event Hubs library `Microsoft.Azure.EventHubs`.
We strongly recommend you to use the current version of the library `Azure.Messaging.EventHubs`.
Leveraging `Azure.Identity`, the new library simplifies the authentication workflow with `DefaultAzureCredential`. Under the hood, `DefaultAzureCredential` combines commonly used credentials, such as managed identity, authentication information set via environment variables or from a logged in Visual Studio Code Azure Account, to authenticate. It attempts to authenticate using the credentials in a specific order. See [here](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/identity/Azure.Identity#azure-identity-client-library-for-net) for more details.
Authorization was one of the most consistent areas of feedback for the Azure SDKs from our customers. Libraries for different Azure services did not have a consistent approach to authorization, roles, etc. The APIs also did not offer a good, approachable, and consistent story for integrating with Azure Active Directory principals. As such, many developers felt that the learning curve was difficult.
The [Azure.Identity](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/identity/Azure.Identity#azure-identity-client-library-for-net) library is intended to address that feedback and provide an approachable and flexible authentication experience across the Azure SDKs, including the `Azure.Messaging.EventHubs` one.

Просмотреть файл

@ -3,10 +3,14 @@
## Run the sample
To run the sample, follow these steps:
**Note:** This sample uses the legacy Event Hubs library `Microsoft.Azure.EventHubs`. We strongly recommend you to use the current library `Azure.Messaging.EventHubs`.
See [sample](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/identity/Azure.Identity/samples/DefiningCustomCredentialTypes.md#authenticating-with-the-on-behalf-of-flow) that uses the new library to authenticate after the environment variables for client id and secret are set.
To run the sample in this folder, which uses the legacy library, follow these steps:
1. Clone or download this GitHub repo.
2. [Create an Event Hubs namespace and an event hub](https://docs.microsoft.com/azure/event-hubs/event-hubs-create).
2. [Create an Event Hubs namespace and an Event Hub](https://docs.microsoft.com/azure/event-hubs/event-hubs-create).
3. Create a Storage account to host a blob container, needed for lease management by the Event Processor Host.
3. [Create a new custom role](https://docs.microsoft.com/en-us/azure/role-based-access-control/custom-roles) with the definition below.
4. [Create a new AAD (Azure Active Directory) application](https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal).
@ -34,21 +38,16 @@ To run the sample, follow these steps:
```
6. Update the sample with Event Hubs namespace and Storage account name.
7. Run [Sender application](https://github.com/Azure/azure-event-hubs/tree/serkar.AddCustomRbacEhSample/samples/DotNet/Microsoft.Azure.EventHubs/SampleSender) to send some number of messages to your event hub.
7. Run [Sender application](https://github.com/Azure/azure-event-hubs/tree/serkar.AddCustomRbacEhSample/samples/DotNet/Microsoft.Azure.EventHubs/SampleSender) to send some number of messages to your Event Hub.
8. Run the CustomRole sample to receive those events back.
**Note:** This sample uses the legacy Event Hubs library `Microsoft.Azure.EventHubs`. We strongly recommend you to use the new library `Azure.Messaging.EventHubs`.
See [this](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/identity/Azure.Identity/samples/DefiningCustomCredentialTypes.md#authenticating-with-the-on-behalf-of-flow) sample that uses the new library to authenticate after the environment variables for client id and secret are set.
## Prerequisites
* [Microsoft Visual Studio 2015 or 2017](http://www.visualstudio.com).
* [.NET Core Visual Studio 2015 or 2017 tools](http://www.microsoft.com/net/core).
* [.NET Core SDK](http://www.microsoft.com/net/core).
* An Azure subscription.
* [An event hub namespace and an event hub](event-hubs-quickstart-namespace-portal.md).
* [An Event Hub namespace and an Event Hub](event-hubs-quickstart-namespace-portal.md).
* An Azure Storage account.

Просмотреть файл

@ -1,6 +1,6 @@
# Managed Service Identity sample #
**Note:** This sample uses the legacy Event Hubs library `Microsoft.Azure.EventHubs`. We strongly encourage you to use the new library `Azure.Messaging.EventHubs`. Here is the corresponding sample using the new library: [link](https://github.com/Azure/azure-event-hubs/tree/master/samples/DotNet/Azure.Messaging.EventHubs/ManagedIdentityWebApp).
**Note:** This sample uses the legacy Event Hubs library `Microsoft.Azure.EventHubs`. We strongly encourage you to use the current library `Azure.Messaging.EventHubs`. See the [corresponding sample](https://github.com/Azure/azure-event-hubs/tree/master/samples/DotNet/Azure.Messaging.EventHubs/ManagedIdentityWebApp) that uses the current library.
For more information on Managed Service Identity (MSI) and how to run this sample follow this [link](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-managed-service-identity).

Просмотреть файл

@ -1,32 +1,32 @@
# Send events to Azure Event Hubs in .NET Standard
This sample shows how to write a .NET Core console application that sends a set of events to an event hub. You can run the solution as-is, replacing the `EhConnectionString` and `EhEntityPath` strings with your event hub values. The sample is also [available as a tutorial](https://docs.microsoft.com/azure/event-hubs/event-hubs-dotnet-standard-getstarted-send).
This sample shows how to write a .NET Core console application that sends a set of events to an Event Hub. You can run the solution as-is, replacing the `EhConnectionString` and `EhEntityPath` strings with your Event Hub values. The sample is also [available as a tutorial](https://docs.microsoft.com/azure/event-hubs/event-hubs-dotnet-standard-getstarted-send).
**Note:** This sample uses the legacy Event Hubs library `Microsoft.Azure.EventHubs`. We strongly encourage you to use the new library `Azure.Messaging.EventHubs`. Here is the corresponding sample using the new library: [link](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/eventhub/Azure.Messaging.EventHubs/samples/Sample04_PublishingEvents.md).
**Note:** This sample uses the legacy Event Hubs library `Microsoft.Azure.EventHubs`. We strongly encourage you to use the current library `Azure.Messaging.EventHubs`. See the [corresponding sample](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/eventhub/Azure.Messaging.EventHubs/samples/Sample04_PublishingEvents.md) that uses the current library.
## Prerequisites
* [Microsoft Visual Studio 2015 or 2017](http://www.visualstudio.com).
* [.NET Core Visual Studio 2015 or 2017 tools](http://www.microsoft.com/net/core).
* [.NET Core SDK](http://www.microsoft.com/net/core).
* An Azure subscription.
* [An event hub namespace and an event hub](event-hubs-quickstart-namespace-portal.md).
* [An Event Hub namespace and an Event Hub](event-hubs-quickstart-namespace-portal.md).
## Run the sample
To run the sample, follow these steps:
1. Clone or download this GitHub repo.
2. [Create an Event Hubs namespace and an event hub](https://docs.microsoft.com/azure/event-hubs/event-hubs-create).
2. [Create an Event Hubs namespace and an Event Hub](https://docs.microsoft.com/azure/event-hubs/event-hubs-create).
3. In Visual Studio, select **File**, then **Open Project/Soultion**. Navigate to the \azure-event-hubs\samples\DotNet\Microsoft.Azure.EventHubs\SampleSender folder.
4. Load the SampleSender.sln solution file into Visual Studio.
5. Add the [Microsoft.Azure.EventHubs](https://www.nuget.org/packages/Microsoft.Azure.EventHubs/) NuGet package to the project.
6. In Program.cs, replace the placeholders in brackets with the proper values that were obtained when creating the event hub. Make sure that the `Event Hubs connection string` is the namespace-level connection string, and not the event hub string:
6. In Program.cs, replace the placeholders in brackets with the proper values that were obtained when creating the Event Hub. Make sure that the `Event Hubs connection string` is the namespace-level connection string, and not the Event Hub string:
```csharp
private const string EhConnectionString = "Event Hubs connection string";
private const string EhEntityPath = "Event Hub name";
```
7. Run the program, and ensure that there are no errors.
Congratulations! You have now sent events to an event hub. To receive these events, see the [SampleEphReceiver](https://github.com/Azure/azure-event-hubs/tree/master/samples/DotNet/Microsoft.Azure.EventHubs/SampleEphReceiver) sample.
Congratulations! You have now sent events to an Event Hub. To receive these events, see the [SampleEphReceiver](https://github.com/Azure/azure-event-hubs/tree/master/samples/DotNet/Microsoft.Azure.EventHubs/SampleEphReceiver) sample.