Migrating from Azure Event Hubs to Apache Kafka

Moving from Event Hubs to self-hosted Apache Kafka is mostly a question of which clients, retention settings, identities and Azure-side pipelines you can keep, and which you must rebuild. This page maps each piece and lays out the migration sequence.

On this page

How to migrate from Azure Event Hubs to Apache Kafka

Most Kafka-protocol producers and consumers can keep their client code when they move to self-hosted Apache Kafka. Microsoft Learn states that existing Kafka workloads run on Event Hubs without code changes, so the usual change is configuration: new bootstrap server addresses, new credentials and any SASL settings the new cluster requires. The features that sit outside the Kafka protocol need deliberate rebuilds. These are Capture to Azure Blob Storage or Azure Data Lake Storage, authentication through Microsoft Entra ID RBAC and managed identities, the retention window configured on each event hub, and managed geo-disaster recovery. Each one needs a named owner, a target design on your own infrastructure and a test that proves the behavior before cutover.

A platform team usually leads the move and works with each application owner on the cutover for their topics. The platform team owns the target cluster, the migration tooling and the authentication design. Application owners own their consumer behavior, including offsets, idempotency and any downstream system that reads a Capture file. Before anyone plans a date, the team should inventory which clients use the Kafka endpoint and which depend on AMQP or HTTPS, since those clients need a Kafka client change and those dependencies decide how much work each application carries. The short answer on effort is that the client change is usually small, and the risk sits in the rebuilt features, the data copy and the cutover window. Confirm the size of each part with a written scope, because DeployOpen does not give an effort figure before the scope is agreed in writing.

What maps cleanly from Event Hubs to Kafka and what needs rework

This table compares each Azure Event Hubs capability with its closest self-managed Apache Kafka equivalent and labels the migration note as clean, needs rework or gap. Rows marked needs rework or gap carry a decision you must confirm before cutover, such as credential design, retention, disaster recovery and schema tooling. The main takeaway: the Kafka protocol carries over, while identity, capture and managed controls must be rebuilt in your own infrastructure.

Event Hubs capabilityApache Kafka equivalentMigration note
Kafka protocol and AMQP 1.0 or HTTPS producersNative Kafka protocol for existing Kafka clients; AMQP 1.0 and HTTPS producers need a bridge or rewriteNeeds rework. Kafka clients carry over, but AMQP 1.0 and HTTPS senders need a bridge or rewrite.
Client configuration and local emulatorBootstrap servers, SASL and TLS properties per application; a local single-node broker replaces the emulatorNeeds rework. Every application changes endpoint and auth properties. Decision: who owns the rollout and the local test setup.
Shared Access SignaturesSCRAM-SHA-256 or SCRAM-SHA-512 users with ACLsNeeds rework. Decision: how credentials are issued, scoped and rotated for each application.
Entra ID RBAC and managed identitiesOAUTHBEARER with an external identity provider, or GSSAPI (Kerberos)Gap. No direct Entra ID role or managed identity equivalent. Decision: identity provider and authorization design to confirm.
Retention: 7 days on Standard, 90 days on Premium and DedicatedRetention set per topic by your team, bounded by broker storageNeeds rework. Microsoft Learn gives the Event Hubs tiers; Kafka retention and disk sizing are your decisions.
Capture to Blob Storage or Data Lake StorageKafka Connect sink connector writing to your object storageGap. No built-in equivalent. Deploy and run Kafka Connect; confirm connector, file format and partitioning.
Schema Registry for Avro and JSONSelf-hosted schema registryNeeds rework. Confluent Schema Registry is under the Confluent Community License; confirm internal-use terms before choosing.
Geo-replication and geo-disaster recoveryMirrorMaker 2 on Kafka Connect copies topics, configurations, consumer offsets and ACLsNeeds rework. Failover, client redirection and offset handling form a runbook you design and test.
Private Link and customer-managed keysPrivate network paths and disk or volume encryption under your own key managementNeeds rework. Confirm network segmentation, key custody and who holds the keys.

Which data, identities and integrations move, and which you rebuild

Six areas decide how much of an Event Hubs estate moves intact and how much you rebuild. Some items need export or translation, some need rework by hand, and a few need a pilot before you commit to a cutover plan. Work through them together, because a cutover that moves events but not offsets, permissions or schemas still breaks consumers.

In-flight events at cutover

Events that Event Hubs has accepted but consumers have not yet read are the first gap in a move. Event Hubs supports the Kafka protocol, so producers may need only connection changes, but a pilot should confirm this for your clients. Decide which system is the source of truth for each topic before any producer switches. Plan a drain window in which consumers finish the Event Hubs backlog, and make consumers idempotent, because a switch can deliver some events twice. Pause producers, drain, then switch is the sequence to test first.

Event Hubs overview

Retained history and backfill

Event Hubs keeps events only for the retention period of your tier, so older history either sits in Capture or is lost. If Capture writes to Azure Blob Storage or Azure Data Lake Storage, those files can serve as the backfill source. Confirm the file format, which metadata Capture stores with each file, and whether Capture was enabled for the full period you need. Then build a replay job that writes records into Kafka topics with original keys, timestamps and ordering. Capture files are a backfill source only after a replay test passes.

Consumer positions and checkpoints

Event Hubs consumers track their place with partition offsets and checkpoints held by the client library or your own store. Kafka tracks positions per consumer group in its own offset records, so each consumer group needs a defined starting point on the new cluster. Kafka's MirrorMaker 2 documents replication of consumer groups with offsets between Kafka clusters, but whether it can read an Event Hubs source is something you must confirm in a pilot. Until then, record the last processed position for every partition before cutover. Do not assume offsets move with the data.

Kafka geo-replication docs

Identities and permissions

Event Hubs access runs through Microsoft Entra ID RBAC, Shared Access Signatures and managed identities. Kafka authenticates clients with SSL or SASL, using GSSAPI, PLAIN, SCRAM-SHA-256, SCRAM-SHA-512 or OAUTHBEARER, and authorizes them through ACLs on topics, consumer groups and the cluster. Map each Entra ID role assignment to a Kafka principal and a set of ACLs, and list which applications need read, write or group permissions. Review service principals that hold broad scopes today, since a copy of role names does not carry their intent. Translate permissions by application, not by role name is the rule to apply.

Kafka authorization docs

Schema definitions

Event Hubs Schema Registry stores Avro and JSON schemas for event payloads, and consumers may depend on its schema IDs or API. Apache Kafka itself does not ship a schema registry, so you must choose one and confirm its license before deployment. Confluent Schema Registry is under the Confluent Community License, which forbids offering it as a hosted service that competes with Confluent, so internal use and any hosted offering need separate review. Export every schema version with its compatibility setting, then test that producers and consumers resolve the same IDs after cutover. Changed schema IDs break consumers silently.

Confluent license FAQ

Azure-side consumers and pipelines

Every Azure service that reads from Event Hubs is a repoint task, including Stream Analytics jobs, Functions triggers, Logic Apps and any pipeline that depends on Capture output. Build the inventory from namespace configurations, connection settings and managed identity assignments, not from architecture diagrams. For each consumer, confirm whether it can read from a self-managed Kafka endpoint or needs a rewritten connector, and confirm that the Kafka endpoint is reachable from the Azure network path it uses. Rebuild private networking and firewall rules for the new path. Any consumer missed in the inventory fails at cutover.

Event Hubs overview

Migration sequence from inventory to decommission

The sequence moves from a full inventory of what Event Hubs carries to a decommission record for the namespace. Each step ends with a named artifact, and the next step starts only when that artifact is signed off. Ownership and consumer data gathered at the start drive every decision that follows.

  1. Inventory topics, consumers and dependencies

    List every Event Hub, consumer group, producer and downstream system that touches the namespace, including applications, Capture destinations in Blob Storage or Data Lake Storage, and Schema Registry schemas. Record which protocol each client uses (Kafka, AMQP 1.0 or HTTPS), how it authenticates (Entra ID RBAC, Shared Access Signatures or managed identities), and the retention setting in place. Assign a named owner to every topic and consumer group. The step is done when the application owners have signed off the inventory and no consumer group is left without an owner.

  2. Pilot one workload on a chosen Kafka release

    Choose one low-risk workload and a supported Apache Kafka release, then build a pilot cluster. Check the Kafka downloads page for the current supported lines before you pick one. Kafka 4.0 supports only KRaft mode, and brokers require Java 17, so plan the platform build around both. Configure SSL or SASL authentication, ACLs and retention to match the inventory. Point the pilot client at the new bootstrap address and test ordering, offsets, throughput and broker failure. Event Hubs also exposes a Kafka endpoint, so confirm for each client whether only connection settings change. The step closes with a passing pilot test report tied to the named Kafka release and a committed configuration.

  3. Run both systems in parallel and reconcile

    Send production traffic through both systems using a dual-produce path or a bridge chosen during the pilot. Confirm that the tool you select can read from Event Hubs before you commit to it. Run each application against both sides and compare event counts, ordering per partition key, consumer lag, dead-letter volume and duplicates. MirrorMaker 2 is built for replication between Kafka clusters, so confirm its fit for Event Hubs as a source before relying on it. Trace every difference to its root cause. The step closes with a reconciliation report covering both systems, where each difference is explained or fixed.

  4. Sign the cutover plan with rollback criteria

    Write the cutover plan one consumer group at a time. For each group, record the order of switches, the producer freeze point, how consumers resume from a known position in the new cluster (Kafka offsets are kept per cluster), the configuration changes, and the person who approves each switch. Define rollback criteria in measurable terms, such as error rates, consumer lag limits or any unresolved reconciliation difference, along with the exact steps to return producers to Event Hubs. Security and application owners review the plan, including ACL and credential changes. The step closes with a signed cutover plan and a rollback runbook.

  5. Decommission Event Hubs and record the closure

    After cutover, keep Event Hubs available for the rollback window written in the plan, then close it down. Event Hubs retains events for up to 7 days on Standard and up to 90 days on Premium and Dedicated, so older events survive only where Capture or another copy holds them. Export or archive what your records require, revoke Shared Access Signatures, remove managed identity role assignments and Private Link endpoints, delete the namespace, and remove alerts and dashboards that point at it. Confirm that the namespace no longer appears in billing. The step closes with a decommission record listing removed resources, revoked credentials, archived data and its location, and the sign-off.

How producers, consumers and the mirror fit during the parallel run

Producers start the flow, writing during the parallel run to Azure Event Hubs and to the self-hosted Kafka cluster. A mirroring layer in your infrastructure copies events from Event Hubs into Kafka. This replication path is a step to confirm in the pilot, including topic mapping and duplicate handling. Each side has its own consumer groups, so teams can compare offsets and lag before moving a group. The cutover point is the hand-off where a consumer group switches from Event Hubs to Kafka. The subgraphs mark the Azure tenant boundary, which separates Microsoft-hosted services from your own infrastructure.

Producers write to both platforms, and consumer groups switch at cutover.

What drives migration cost and duration, and how to keep each down

This table lists the drivers that move cost and duration in an Event Hubs to Kafka move, and how to keep each one down. Read the one-time work (inventory, build, pilot, cutover and any consultant fees) against the recurring self-hosted costs (brokers, storage, runtimes, upgrades, backups, monitoring and staff). Ask any quote to price each driver separately and to state assumptions for hub count, client types, retention and the parallel run period.

DriverWhy it moves cost or timeHow to keep it down
Event hubs, namespaces and consumer groupsEach hub becomes topics, partitions, ACLs and monitoring; consumer groups carry offsets that must be reset or translated.Inventory every hub and group first, merge low-volume hubs into domain topics, and retire unused hubs before build.
Client protocols (AMQP and HTTPS producers)Existing Kafka clients usually need configuration changes only, while AMQP 1.0 and HTTPS producers need more rewriting.Tag each producer by protocol, rebuild AMQP and HTTPS senders on Kafka client libraries, and pilot one of each.
Message size and ingress countingBasic and Standard bill ingress per million events, each event up to 64 KB counting as one, so batching affects the bill.Measure current event sizes and batching, set Kafka message limits, and test the largest payloads in the pilot.
Retention and replayEvent Hubs retains up to 7 days on Standard and 90 days on Premium or Dedicated (Microsoft Learn). Kafka storage grows with retention.Set retention per topic from agreed replay windows, and size broker storage for that window.
Capture and schema pipelinesCapture writes to Blob Storage or Data Lake Storage, and Schema Registry serves Avro and JSON; each sink and consumer needs a replacement.List every Capture target and schema consumer, use Kafka Connect sinks where they fit, and check the license of any schema registry.
Authentication modelEntra ID RBAC, SAS keys and managed identities must map to Kafka SASL or SSL identities and ACLs.Choose a SASL mechanism early with the identity team, map each Azure role to ACLs, and retire shared keys last.
Disaster recovery and network designGeo-replication and Private Link are managed by Azure; self-hosted DR, replication and private paths are your build.Design the second cluster and MirrorMaker 2 replication before cutover, and test failover with the network team.
Length of the parallel runEvent Hubs billing continues while both platforms run, so every extra week of overlap adds to the migration cost.Set exit criteria per consumer group, cut over in waves, and decommission each hub once its wave passes.
Ongoing self-hosted costsBrokers, storage, Java 17 runtimes, upgrades, backups, monitoring and staff recur for as long as the cluster runs.Size brokers from measured load, plan upgrade work around Kafka's aim of three releases a year, and confirm who runs each task.

What usually goes wrong in an Event Hubs to Kafka move and how to prevent it

Most failed Event Hubs to Kafka moves fail quietly. The problems below appear after cutover, in reports, consumer lag or a pipeline nobody listed, so each card names the check to run before traffic moves. Treat each check as a gate in the cutover plan, with an owner and a sign-off.

Duplicate or missing events

Producers that keep writing to Event Hubs after Kafka starts taking traffic create duplicates or gaps that surface only when reports disagree. Consumer positions cause the same damage: a group that starts at the wrong offset reprocesses old events or skips new ones. Freeze producers for each topic, map every consumer group's Event Hubs checkpoint to a Kafka offset, and reconcile counts per partition. Keep the Event Hubs namespace running but unused, and decommission it only after the data owners sign off the reconciliation report.

Per-key ordering changes

Both platforms send events with the same partition key to one partition, but the partition count and the key-to-partition mapping on the new cluster are settings you must confirm before cutover. A consumer that expects one device or account to produce a strict sequence can break without any error. Test per-key ordering on the target Kafka cluster with the partition count you plan to run. Also confirm which producers set a key at all, because unkeyed events carry no ordering promise on either platform.

Retention too short for backfill

Event Hubs retention is up to 7 days on Standard and up to 90 days on Premium and Dedicated, so the replay window you can get from the old namespace depends on your tier. On Kafka, retention is a topic setting you choose, but the disk on every broker must hold the full backfill window, plus replicas. Set topic retention to cover the longest replay you need, then size storage for it. Before the old namespace stops taking writes, check how far back its data goes and which consumers need history older than the new retention.

Event Hubs overview

Silent authentication failures

Event Hubs clients usually authenticate with Microsoft Entra ID RBAC, Shared Access Signatures or managed identities, and those credentials do not carry over to Kafka. Kafka authenticates with SSL or SASL, using mechanisms such as SCRAM-SHA-512, OAUTHBEARER or GSSAPI, and each principal needs its own ACLs. Map every Event Hubs identity to a Kafka mechanism and ACL, then test each client against the new endpoint. Failed logins can look like network faults or stalled consumers, so alert on authentication errors from the first day of cutover.

Kafka security overview

Capture pipeline without a replacement

Event Hubs Capture writes events to Azure Blob Storage or Azure Data Lake Storage, so a downstream lake, archive or report may depend on it without anyone listing it as a consumer. When the namespace is switched off, that output stops and nothing on the Kafka side reports the gap. Inventory every Capture destination and the jobs that read it, then build and run a replacement, such as a Kafka Connect sink, before cutover. Confirm the replacement writes the file layout and time partitions those jobs expect.

Kafka release and runtime requirements

Kafka 4.0 supports only KRaft mode, so a ZooKeeper-based cluster must migrate to KRaft before upgrading to 4.x, and KRaft clusters older than 3.3.x should first move to 3.9.x. Brokers, Kafka Connect and tools require Java 17, while clients and Kafka Streams applications need at least Java 11. The downloads page lists 4.3.1, 4.2.2 and 4.1.2 as supported releases. Choose a listed release, then confirm KRaft and Java 17 on every broker and Connect host before cutover.

Kafka upgrade notes

How the move differs for small estates, shared namespaces and AMQP-heavy workloads

A single team with a few event hubs can usually move in one pass. The sequence is short: build the cluster, recreate the topics that carry live traffic, point producers and consumers at the new cluster in a planned window, then retire the old namespace. The rebuild list stays small, so most of the work is client configuration, authentication and retention settings that match what the team depends on today. Event Hubs Standard keeps data for up to 7 days, and Premium and Dedicated keep it for up to 90 days, so a team on a longer tier must decide whether Kafka retention or an archive store carries that history.

  • Sequence: Build the cluster and topics first, then move one consumer group at a time to keep the cutover window short.
  • Rebuild list: Recreate topics with partition counts and retention settings, plus any archiving that replaces Capture to Blob Storage or Data Lake Storage.
  • Authentication: Replace Entra ID RBAC, shared access signatures or managed identities with the Kafka SASL mechanisms or TLS that your clients support.
  • Cutover: Name one owner and one rollback point, which a small team can agree in a single short review.

Confirm first: which Azure-side features the hubs use (Capture, Schema Registry, Private Link), and how much history must survive the move.

What buyers ask before moving from Event Hubs to Kafka

How much does it cost to move from Event Hubs to self-hosted Kafka?

Apache Kafka carries no license fee, so the cost moves to infrastructure, operations and migration work. Your Event Hubs pricing bill is set by tier: hourly charges per throughput unit on Basic and Standard, per processing unit on Premium, or per capacity unit on Dedicated, plus per-million ingress charges on Basic and Standard. On your side, recurring costs include servers or cloud instances, storage sized for your retention, network, backups, monitoring, on-call time and upgrades. One-time costs include migration work, client configuration changes and parallel running during cutover. Throughput, retention length, replication factor and cluster count move the totals most. Ask for a quote that prices each component separately and names who pays for each.

How long does an Event Hubs to Kafka migration take?

The timeline comes from the scope agreed in writing, and it depends mostly on the factors below. The main drivers are the number of producers and consumers, how many Event Hubs namespaces and event hubs you run, and how many of them depend on Capture, Schema Registry or Azure identity. Retention also matters. Event Hubs keeps data for up to 7 days on Standard and up to 90 days on Premium and Dedicated, so you decide whether history must be replayed into Kafka and how long that replay runs. Parallel running for validation, security hardening and the compliance evidence you need will add to the schedule. Ask for a plan that lists phases, entry and exit criteria for each cutover wave, and the dates your team must hold.

What does our internal team need to provide during the migration?

Your team owns the inventory of what runs on Event Hubs today, including namespaces, event hubs, producers, consumers, schemas and retention needs. It also owns the identity decisions. Event Hubs authenticates with Microsoft Entra ID RBAC, Shared Access Signatures or managed identities, while Kafka authenticates clients, brokers and tools over SSL or SASL, with mechanisms such as SCRAM-SHA-512 or OAUTHBEARER. Network design, certificates and DNS usually sit with your platform team, and each application owner must be available to test. After go-live, someone must run broker monitoring, backups and upgrades. Agree these named owners and their time in the written scope, because migrations stall when application owners are not available for testing.

Can our own engineers complete this migration without an outside partner?

Yes, a capable internal team can run this migration, but the work spans more than moving clients. Apache Kafka is Apache 2.0 licensed and its documentation covers KRaft setup, security, authorization and upgrades, so the technical material is public. The open question is whether your team has the time and production experience to run it. Skills needed include broker operations, SASL and ACL design, TLS, backup, monitoring, upgrade planning and cutover testing. Partners such as DeployOpen take on fixed-scope work: they plan, implement, customize, integrate, harden, back up, upgrade, document and support self-hosted platforms inside your infrastructure, with scope, deliverables and timelines agreed in writing before work starts. A written scope lets you compare the internal option with an outside quote on the same list of tasks.

Do existing Kafka clients need code changes to move to self-hosted Kafka?

Clients that already speak the Kafka protocol usually need configuration changes, and application logic often stays the same. Microsoft states that Event Hubs supports the Kafka protocol, so existing Kafka workloads can run there without code changes. Moving to your own cluster still means updating bootstrap servers, TLS trust settings and SASL credentials. Clients that authenticate with Microsoft Entra ID or Shared Access Signatures through the Event Hubs endpoint need their authentication setup replaced. Azure SDK code, AMQP 1.0 clients and HTTPS producers also need changes, because they are not Kafka clients. Inventory each client by protocol, authentication method and library version, and check Java levels, since Kafka Streams applications need at least Java 11. Put that inventory in the written scope.

Can we keep Event Hubs Capture and Schema Registry after moving to Kafka?

Neither feature moves across unchanged, so each one needs a replacement. Capture writes events to Azure Blob Storage or Azure Data Lake Storage. A self-hosted equivalent usually uses Kafka Connect sink connectors that write to your own storage, and you should confirm the connector's license, maintenance status and failure handling before choosing it. Schema Registry for Avro and JSON schemas needs separate attention. Confluent's Schema Registry is under the Confluent Community License, which forbids offering it as a hosted service that competes with Confluent, while Apache Kafka itself stays under Apache 2.0. Have counsel confirm how that license applies to your internal use. Ask that existing schemas and compatibility rules be migrated and tested in the written scope.

Which Apache Kafka release should we target for the migration?

Target the newest supported release that your client libraries support, and confirm the list before you commit. The Kafka downloads page lists 4.3.1 (June 25, 2026), 4.2.2 (September 29, 2026) and 4.1.2 (March 17, 2026) as supported, and older releases are archived. Kafka 4.0 supports only KRaft mode, so any ZooKeeper-based cluster must migrate to KRaft before upgrading to 4.x. The upgrade notes recommend moving KRaft clusters older than 3.3.x to 3.9.x before 4.x. Brokers, Kafka Connect and tools need Java 17 from 4.0 onward. Rolling upgrades are supported from each of the last three releases to the latest version, so choose a line you can keep current. Confirm these requirements against your own client inventory.

What happens to retained events and history during the move?

Event Hubs keeps events only for a limited window, so the history you can migrate is bounded by that window and by what you decide to copy. Retention is up to 7 days on Standard and up to 90 days on Premium and Dedicated. On your own Kafka cluster, you set retention per topic with settings such as retention.ms, so storage cost grows with the window you keep. Confirm how consumer positions carry over. Kafka's geo-replication documentation covers offset and consumer group replication between Kafka clusters, but an Event Hubs source needs its own plan for offsets and replay. Ask the provider to document the cutover, rollback and replay steps in the written scope.

How DeployOpen scopes and runs an Event Hubs to Kafka migration

DeployOpen plans, implements, customizes, integrates, hardens, backs up, upgrades, documents and supports self-hosted open-source platforms inside your own infrastructure. The work begins with a written scope that names each namespace, client and retention need, and ends with Kafka running in your cloud accounts or data centers. Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.

How we scope

  • The written scope lists each Event Hubs namespace, its tiers, and the producers and consumers that depend on it.
  • Scope also records which clients already speak Kafka and which AMQP 1.0 or HTTPS senders need changes.
  • Scope records current retention against Event Hubs limits of up to 7 days on Standard and 90 on Premium.

How we build

  • Kafka runs on KRaft in your cloud accounts or data centers, because Kafka 4.0 dropped ZooKeeper mode.
  • Clients authenticate with SSL or SASL, such as SCRAM or OAUTHBEARER, and ACLs are set per topic.
  • Test whether MirrorMaker 2 can read from the Event Hubs Kafka endpoint before relying on it for replication.

How we hand over

  • Handover covers the migrated topics, client configuration, ACL and identity mapping, and runbooks for the cutover.
  • Documentation records the producer and consumer inventory, the retention settings, and the rollback steps.
  • Test results and compliance evidence are delivered for your own assessors, since DeployOpen does not issue audit reports.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • Upgrade planning follows Kafka's time-based release plan, which supports rolling upgrades from the last three releases.
  • Confirm with your team which operating duties stay in-house and which go to a retainer.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.