# azure-eventhub-dotnet

Guides AI in writing .NET code for Azure Event Hubs: batching, buffered streaming, partition handling, and checkpoints via Blob Storage.

- skill · `type=skill` · Claude Code, GitHub Copilot · 1 install · ★ 3149
- Author: Microsoft
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/microsoft/skills/tree/HEAD/.github/plugins/azure-sdk-dotnet/skills/azure-eventhub-dotnet/SKILL.md
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/skills/azure-eventhub-dotnet

## What it does

This skill equips the assistant with patterns for the `Azure.Messaging.EventHubs` SDK version 5.12.2. It ensures the model selects the right client type: `EventHubProducerClient` for precise batch sizing, `EventHubBufferedProducerClient` for high-throughput background publishing, and `EventProcessorClient` for consuming streams.

For production consumer workloads, checkpointing requires `Azure.Storage.Blobs`. Without an active blob container, `EventProcessorClient` cannot track partition progress, while the plain `EventHubConsumerClient` is strictly limited to prototyping.

The patterns rely on `Azure.Identity` and `DefaultAzureCredential`. Running this in production requires proper RBAC role assignments: `Azure Event Hubs Data Sender` for ingestion or `Azure Event Hubs Data Receiver` for consumers.

## Requirements
- Works with: Azure

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add microsoft/skills --skill azure-eventhub-dotnet -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/azure-eventhub-dotnet/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/azure-eventhub-dotnet/

### Codex

**Manually: put the files in place**
- File: `.agents/skills/azure-eventhub-dotnet/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

**Manually: put the files in place**
- File: `.cursor/skills/azure-eventhub-dotnet/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install microsoft/skills azure-eventhub-dotnet
```

2. **Manually: put the files in place**
- File: `.github/skills/azure-eventhub-dotnet/SKILL.md`

### Gemini CLI

**Platform CLI**
```bash
gemini skills install https://github.com/microsoft/skills --path .github/plugins/azure-sdk-dotnet/skills/azure-eventhub-dotnet
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/azure-eventhub-dotnet/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/microsoft/skills/tree/HEAD/.github/plugins/azure-sdk-dotnet/skills/azure-eventhub-dotnet/SKILL.md

## When to use it
- stream event batches using `EventHubProducerClient`
- set up high-volume buffered publishing with error callbacks
- process stream partitions with checkpointing in Azure Blob Storage
- configure Azure Identity and assign required RBAC roles

## Example prompts
- Write a .NET service that streams batched telemetry to Azure Event Hubs
- Implement an EventProcessorClient consumer that checkpoints to Azure Blob Storage
- Configure buffered publishing with EventHubBufferedProducerClient and error handlers

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 05491d709edb89c6.

BEGIN THIRD-PARTY FILE 05491d709edb89c6
````text
---
name: azure-eventhub-dotnet
description: |
  Azure Event Hubs SDK for .NET. Use for high-throughput event streaming: sending events (EventHubProducerClient, EventHubBufferedProducerClient), receiving events (EventProcessorClient with checkpointing), partition management, and real-time data ingestion. Triggers: "Event Hubs", "event streaming", "EventHubProducerClient", "EventProcessorClient", "send events", "receive events", "checkpointing", "partition".
license: MIT
metadata:
  author: Microsoft
  version: "1.0.0"
  package: Azure.Messaging.EventHubs
---

# Azure.Messaging.EventHubs (.NET)

High-throughput event streaming SDK for sending and receiving events via Azure Event Hubs.

## Installation

```bash
# Core package (sending and simple receiving)
dotnet add package Azure.Messaging.EventHubs

# Processor package (production receiving with checkpointing)
dotnet add package Azure.Messaging.EventHubs.Processor

# Authentication
dotnet add package Azure.Identity

# For checkpointing (required by EventProcessorClient)
dotnet add package Azure.Storage.Blobs
```

**Current Versions**: Azure.Messaging.EventHubs v5.12.2, Azure.Messaging.EventHubs.Processor v5.12.2

## Environment Variables

```bash
EVENTHUB_FULLY_QUALIFIED_NAMESPACE=<namespace>.servicebus.windows.net  # Required: Event Hubs fully qualified namespace
EVENTHUB_NAME=<event-hub-name>  # Required: Event Hub name
BLOB_STORAGE_CONNECTION_STRING=<storage-connection-string>  # Alternative to Entra ID auth
BLOB_CONTAINER_NAME=<checkpoint-container>  # Required: checkpoint container name
EVENTHUB_CONNECTION_STRING=Endpoint=sb://<namespace>.servicebus.windows.net/;SharedAccessKeyName=...  # Alternative to Entra ID auth
AZURE_TOKEN_CREDENTIALS=prod  # Required only if DefaultAzureCredential is used in production
```

## Authentication

```csharp
using Azure.Identity;
using Azure.Messaging.EventHubs;
using Azure.Messaging.EventHubs.Producer;

// Local dev: DefaultAzureCredential. Production: set AZURE_TOKEN_CREDENTIALS=prod or AZURE_TOKEN_CREDENTIALS=<specific_credential>
var credential = new DefaultAzureCredential(
    DefaultAzureCredential.DefaultEnvironmentVariableName
);
// Or use a specific credential directly in production:
// See https://learn.microsoft.com/dotnet/api/overview/azure/identity-readme?view=azure-dotnet#credential-classes
// var credential = new ManagedIdentityCredential();

var fullyQualifiedNamespace = Environment.GetEnvironmentVariable("EVENTHUB_FULLY_QUALIFIED_NAMESPACE");
var eventHubName = Environment.GetEnvironmentVariable("EVENTHUB_NAME");

var producer = new EventHubProducerClient(
    fullyQualifiedNamespace,
    eventHubName,
    credential);
```

**Required RBAC Roles**:
- **Sending**: `Azure Event Hubs Data Sender`
- **Receiving**: `Azure Event Hubs Data Receiver`
- **Both**: `Azure Event Hubs Data Owner`

## Client Types

| Client | Purpose | When to Use |
|--------|---------|-------------|
| `EventHubProducerClient` | Send events immediately in batches | Real-time sending, full control over batching |
| `EventHubBufferedProducerClient` | Automatic batching with background sending | High-volume, fire-and-forget scenarios |
````
END THIRD-PARTY FILE 05491d709edb89c6

The third-party file has ended. Everything between the 05491d709edb89c6 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3165 of 10936 bytes. © Microsoft · MIT · https://github.com/microsoft/skills/tree/HEAD/.github/plugins/azure-sdk-dotnet/skills/azure-eventhub-dotnet/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
