Azure.ResourceManager.EventHubs 1.0.0

Azure Event Hubs Management client library for .NET

This package follows the new Azure SDK guidelines which provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more.

Getting started

Install the package

Install the Azure Event Hubs management library for .NET with NuGet:

dotnet add package Azure.ResourceManager.EventHubs

Prerequisites

Set up a way to authenticate to Azure with Azure Identity.

Some options are:

More information and different authentication approaches using Azure Identity can be found in this document.

Authenticate the Client

The default option to create an authenticated client is to use DefaultAzureCredential. Since all management APIs go through the same endpoint, in order to interact with resources, only one top-level ArmClient has to be created.

To authenticate to Azure and create an ArmClient, do the following:

using Azure.Identity;
ArmClient armClient = new ArmClient(new DefaultAzureCredential());

Additional documentation for the Azure.Identity.DefaultAzureCredential class can be found in this document.

Key concepts

Key concepts of the Azure .NET SDK can be found here

Examples

Create a namespace

Before creating a namespace, we need to have a resource group.

ArmClient armClient = new ArmClient(new DefaultAzureCredential());
SubscriptionResource subscription = await armClient.GetDefaultSubscriptionAsync();
string rgName = "myRgName";
AzureLocation location = AzureLocation.WestUS2;
ArmOperation<ResourceGroupResource> operation = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, new ResourceGroupData(location));
ResourceGroupResource resourceGroup = operation.Value;

Then we can create a namespace inside this resource group.

string namespaceName = "myNamespace";
EventHubsNamespaceCollection namespaceCollection = resourceGroup.GetEventHubsNamespaces();
AzureLocation location = AzureLocation.EastUS2;
EventHubsNamespaceResource eventHubNamespace = (await namespaceCollection.CreateOrUpdateAsync(WaitUntil.Completed, namespaceName, new EventHubsNamespaceData(location))).Value;

Get all namespaces in a resource group

EventHubsNamespaceCollection namespaceCollection = resourceGroup.GetEventHubsNamespaces();
await foreach (EventHubsNamespaceResource eventHubNamespace in namespaceCollection.GetAllAsync())
{
    Console.WriteLine(eventHubNamespace.Id.Name);
}

Get a namespace

EventHubsNamespaceCollection namespaceCollection = resourceGroup.GetEventHubsNamespaces();
EventHubsNamespaceResource eventHubNamespace = await namespaceCollection.GetAsync("myNamespace");
Console.WriteLine(eventHubNamespace.Id.Name);

Delete a namespace

EventHubsNamespaceCollection namespaceCollection = resourceGroup.GetEventHubsNamespaces();
EventHubsNamespaceResource eventHubNamespace = await namespaceCollection.GetAsync("myNamespace");
await eventHubNamespace.DeleteAsync(WaitUntil.Completed);

Add a tag to the namespace

EventHubsNamespaceCollection namespaceCollection = resourceGroup.GetEventHubsNamespaces();
EventHubsNamespaceResource eventHubNamespace = await namespaceCollection.GetAsync("myNamespace");
await eventHubNamespace.AddTagAsync("key","value");

For more detailed examples, take a look at samples we have available.

Troubleshooting

Next steps

More sample code

Additional Documentation

For more information on Azure SDK, please refer to this website.

Contributing

For details on contributing to this repository, see the contributing guide.

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Showing the top 20 packages that depend on Azure.ResourceManager.EventHubs.

Packages Downloads
Azure.Provisioning
Contains the core functionality for defining Azure infrastructure with dotnet code.
1

https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.EventHubs_1.0.0/sdk/eventhub/Azure.ResourceManager.EventHubs/CHANGELOG.md

.NET Standard 2.0

Version Downloads Last updated
1.2.0 1 6/16/2025
1.2.0-beta.1 1 6/14/2025
1.1.0 1 6/15/2025
1.1.0-beta.8 1 6/15/2025
1.1.0-beta.7 1 6/15/2025
1.1.0-beta.6 1 6/15/2025
1.1.0-beta.5 1 6/15/2025
1.1.0-beta.4 1 6/15/2025
1.1.0-beta.3 1 6/15/2025
1.1.0-beta.2 1 6/15/2025
1.1.0-beta.1 1 6/15/2025
1.0.1 1 6/15/2025
1.0.0 1 6/15/2025
1.0.0-beta.4 1 6/15/2025
1.0.0-beta.3 1 6/15/2025