An Azure real-time data ingestion service.
A dedicated firewall is not strictly required to restrict traffic to Azure Event Hubs. Event Hubs provides built‑in network security features that can be used instead of, or in addition to, a traditional firewall to control access.
Key options to restrict traffic without a separate firewall:
- IP firewall rules on the Event Hubs namespace
Event Hubs has a built‑in IP firewall at the namespace level:- Allow only specific IPv4/IPv6 addresses or ranges in CIDR notation.
- Any connection from an IP that does not match an allowed rule is rejected as unauthorized.
- Rules are evaluated in order; the first matching rule determines allow/deny.
- When IP filtering is enabled, blocked requests include other Azure services, Azure portal, logging, etc., unless explicitly allowed as trusted services.
- This feature is not supported in the Basic tier.
- Azure portal: Networking → Public access → Firewall → Selected networks, then add IP addresses/ranges.
- Azure CLI:
az eventhubs namespace network-rule-setcommands. - PowerShell:
Set-AzEventHubNetworkRuleSet. - ARM templates: add IP rules and set
defaultActiontoDeny(and ensure at least one IP or virtual network rule is present).
- Virtual network integration (service endpoints / private endpoints)
Instead of exposing Event Hubs to the public internet:- Use virtual network rules with service endpoints to allow only traffic from specific subnets.
- Or disable public access and use private endpoints so Event Hubs is reachable only via private IPs in your VNet.
- Network Security Groups (NSGs) and Azure Firewall with service tags
On the VNet side, traffic to Event Hubs can be controlled using:- NSGs or Azure Firewall rules that reference the
EventHubservice tag as destination. - This lets outbound rules allow or deny traffic to Event Hubs without managing individual IP ranges.
- NSGs or Azure Firewall rules that reference the
- Network Security Perimeter (NSP)
Event Hubs can be associated with a Network Security Perimeter to provide a logical network boundary:- Define inbound access rules (which IPs/resources/subscriptions can send data to Event Hubs).
- Define outbound access rules (which external resources Event Hubs can call, e.g., Storage for Capture, Key Vault).
- Manage access at perimeter level instead of per‑service firewall, and get diagnostic logging for network access attempts.
- Protocol/port control at your network edge
If using your own firewall, restrict outbound ports needed by Event Hubs clients:- AMQP: TCP 5671/5672.
- HTTPS and AMQP‑over‑WebSockets: TCP 443.
- Kafka: TCP 9093.
You can choose AMQP‑over‑WebSockets to use only port 443 if that aligns with your network policy.
In summary, a traditional firewall device is not mandatory. Access can be restricted using Event Hubs IP firewall rules, virtual network rules (service endpoints/private endpoints), NSGs/Azure Firewall with service tags, and Network Security Perimeter, combined with protocol/port controls.
References: