---
title: AMQP Ports 5671 and 5672 - Azure Service Bus and Event Hub Configuration
description: Configure and troubleshoot AMQP ports 5671 and 5672 for Azure Service Bus and Event Hub connectivity. Includes firewall rules, PowerShell testing, and authentication guidance.
---

# <i class="fal fa-link" aria-hidden="true"></i> AMQP Ports 5671 and 5672 Configuration for Azure

This guide consolidates configuration requirements for AMQP ports 5671 and 5672 across [Azure Service Bus][] and Azure Event Hub scenarios. Both services use the same AMQP protocol and port numbers for secure message communication. It applies to the [Message Queueing Monitoring Agent][Message Queuing Agent] (Azure Service Bus), the [Azure Logic Apps Logging and Monitoring Agent][LogicAppsAgent] (Event Hubs), and the [Pickup Service][Pickup EventHub] (Event Hubs).

The firewall rules for every hop of each agent live on that agent's Prerequisites page, for example [Message Queueing Agent and Azure Service Bus][FW MQ ASB] and [Logic Apps agent and Azure][FW Logic Apps Azure]. This page explains the AMQP ports those pages refer to and how to test them.

## <i class="fal fa-network-wired" aria-hidden="true"></i> Understanding the AMQP Connections

<div class="mermaid">
flowchart LR
    subgraph AGENT["Nodinite Agent Server"]
        AG["fa:fa-microchip Agent<br/>Message Queueing, Logic Apps, or Pickup Service"]
    end
    subgraph AZ["Microsoft Azure"]
        ENTRA["fa:fa-id-card Microsoft Entra ID<br/>login.microsoftonline.com"]
        SB["fa:fa-envelope Service Bus and Event Hubs<br/>*.servicebus.windows.net"]
    end
    DNS["fa:fa-server DNS server"]
    AG -->|"443 token request"| ENTRA
    AG -->|"5671 AMQP over TLS"| SB
    AG -->|"443 HTTPS"| SB
    AG -->|"53"| DNS
    style AG fill:#2678BD,color:#fff
    style ENTRA fill:#9E59BB,color:#fff
    style SB fill:#3F827B,color:#fff
</div>

*Diagram: the agent (blue) opens every connection outbound: HTTPS 443 to Microsoft Entra ID for a token when it uses an [App Registration][Azure Application Access], AMQP over TLS on 5671 and HTTPS on 443 to the Service Bus or Event Hubs namespace (teal), and DNS. No inbound rule is needed on the agent's network. [Service Bus Relaying][Configure Service Bus Relaying] uses the same namespace host names, on 443 only: it needs neither the AMQP ports nor 9350–9354.*

## Understanding AMQP: Alternative to HTTPS

### What is AMQP?

**AMQP** (Advanced Message Queuing Protocol) is a binary, standards-based messaging protocol optimized for reliable message transmission. While Azure Service Bus and Event Hub support both **HTTPS (port 443)** and **AMQP (ports 5671, 5672)**, AMQP offers:

* **Lower Latency** - Binary protocol reduces overhead compared to HTTP/REST
* **Connection Reuse** - Single persistent connection for multiple operations
* **Reduced Bandwidth** - Smaller message envelopes than JSON/REST
* **Better Throughput** - Optimized for high-volume scenarios

### Port Numbering Convention

| Port | Protocol | Use Case | Security |
|------|----------|----------|----------|
| **5671** | AMQP over TLS | Production connections requiring TLS encryption | TLS 1.2+ |
| **5672** | AMQP | Unencrypted AMQP (rarely used in cloud) | No encryption |

**Best Practice:** Always use port 5671 (secure AMQP with TLS). Port 5672 without encryption is uncommon in Azure scenarios.

## Azure Service Bus - AMQP Configuration

Azure Service Bus supports AMQP for queues and topics; relaying uses port 443 only. This is the primary integration point for <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> Message Queueing [Monitoring Agents][].

### Firewall Requirements

#### Outbound Rules (from Monitoring Agent to Azure)

| Direction | Source | Destination | Protocol | Port(s) | Purpose | Security |
|-----------|--------|-------------|----------|---------|---------|----------|
| **Outbound** | Agent Server | `*.servicebus.windows.net` | TCP | **5671, 5672** | AMQP connection to Service Bus | TLS 1.2+ on 5671 |
| **Outbound** | Agent Server | `*.servicebus.windows.net` | TCP | **443** | Initial authentication & control plane | HTTPS/TLS |

#### Inbound Rules

None. The agent opens every connection, and a stateful firewall allows the response traffic automatically.

**Azure-Side Note:** No inbound firewall configuration required on Azure Service Bus. The service is cloud-hosted and manages its own ingress filtering.

### PowerShell Connectivity Testing

Test connectivity from your Monitoring Agent server to Azure Service Bus using PowerShell's `Test-NetConnection` cmdlet:

```powershell
# Replace [service-bus-name] with your actual Service Bus namespace
$ServiceBusName = "[service-bus-name]"

# Test port 5671 (Secure AMQP)
Test-NetConnection -ComputerName "$ServiceBusName.servicebus.windows.net" -Port 5671 -InformationLevel Detailed

# Test port 5672 (AMQP - legacy)
Test-NetConnection -ComputerName "$ServiceBusName.servicebus.windows.net" -Port 5672 -InformationLevel Detailed

# Test port 443 (HTTPS - control plane)
Test-NetConnection -ComputerName "$ServiceBusName.servicebus.windows.net" -Port 443 -InformationLevel Detailed
```

#### Expected Output

A successful test:

```text
ComputerName     : [service-bus-name].servicebus.windows.net
RemotePort       : 5671
TcpTestSucceeded : True
```

A blocked port:

```text
ComputerName     : [service-bus-name].servicebus.windows.net
RemotePort       : 5671
TcpTestSucceeded : False
```

#### Interpreting Test Results

| Result | Meaning | Common Cause | Resolution |
|--------|---------|--------------|-----------|
| `TcpTestSucceeded : True` | ✅ Connection successful | Firewall rule permits traffic | Proceed with agent configuration |
| `TcpTestSucceeded : False` | ❌ Connection blocked | Firewall blocks AMQP ports | Add outbound firewall rule for ports 5671/5672 to `*.servicebus.windows.net` |
| `TcpTestSucceeded : False` (immediate) | ❌ Connection refused | DNS resolution failed or destination unreachable | Verify Service Bus namespace name; verify internet connectivity |
| `TcpTestSucceeded : False` (after timeout) | ❌ Connection timeout | Firewall dropping packets silently | Check corporate proxy/firewall rules; verify HTTPS port 443 is open for control plane |

### Authentication Requirements

<span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> agents connecting via AMQP to Azure Service Bus with an App Registration require the following; the full role list per agent is in [Least Privileges][AzureApplicationsAccessLP]:

* **Microsoft Entra ID (Azure AD) Application Registration** with:
  * **Application ID** (Client ID)
  * **Tenant ID**
  * **Client Secret** or **Certificate Credential**

* **Role Assignment** on the Service Bus Namespace:
  * `Azure Service Bus Data Owner` - for sending/receiving messages
  * `Reader` - on the parent Subscription (for resource discovery)

[For detailed Entra ID authentication setup, see Authenticate and authorize an application with Microsoft Entra ID to access Azure Service Bus entities.](https://learn.microsoft.com/en-us/azure/service-bus-messaging/authenticate-application?tabs=dotnet)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>

## Azure Event Hub - AMQP Configuration

Azure Event Hubs use AMQP for log ingestion in <span class="nodinite-product-name" title="The node that unites different systems. Or as we call it Nodinite">Nodinite</span> Azure Logic Apps scenarios. When you [configure Azure Logic Apps diagnostic logs to send to Event Hub][Logic Apps Event Hubs], the [Logic Apps agent][LogicAppsAgent] connects via AMQP; it needs the Azure Event Hubs Data Receiver and Storage Blob Data Contributor roles, or Shared access policy connection strings.

### Firewall Requirements

#### Outbound Rules (from Monitoring Agent to Azure)

| Direction | Source | Destination | Protocol | Port(s) | Purpose | Security |
|-----------|--------|-------------|----------|---------|---------|----------|
| **Outbound** | Agent Server | `*.servicebus.windows.net` | TCP | **5671, 5672** | AMQP to Event Hub | TLS 1.2+ on 5671 |
| **Outbound** | Agent Server | `*.servicebus.windows.net` | TCP | **443** | Control plane (authentication, discovery) | HTTPS/TLS |

**Note:** Event Hubs are hosted within the Azure Service Bus infrastructure (`*.servicebus.windows.net`), so firewall rules are identical to Service Bus.

### PowerShell Connectivity Testing

Test connectivity to an Event Hub using the same pattern as Service Bus:

```powershell
# For Event Hub in namespace [event-hub-namespace]
$EventHubNamespace = "[event-hub-namespace]"

# Test port 5671 (Secure AMQP)
Test-NetConnection -ComputerName "$EventHubNamespace.servicebus.windows.net" -Port 5671 -InformationLevel Detailed

# Test port 443 (HTTPS - control plane)
Test-NetConnection -ComputerName "$EventHubNamespace.servicebus.windows.net" -Port 443 -InformationLevel Detailed
```

### When Event Hubs Use AMQP

Event Hubs use AMQP when:

* Consuming log streams from Azure Logic Apps diagnostic endpoints
* High-throughput scenarios requiring persistent connections
* Custom event processors reading from Event Hub consumer groups

## Firewall Configuration Examples

### Example 1: Corporate Firewall (Windows Firewall on Agent Server)

Allow outbound AMQP traffic to Azure Service Bus:

```powershell
# Add outbound firewall rule for AMQP ports
New-NetFirewallRule -DisplayName "Allow AMQP to Azure Service Bus" `
  -Direction Outbound `
  -Action Allow `
  -Protocol TCP `
  -RemotePort 5671,5672 `
  -RemoteAddress "*" `
  -Description "Allow Monitoring Agent to reach Azure Service Bus via AMQP"

# Verify rule was created
Get-NetFirewallRule -DisplayName "Allow AMQP to Azure Service Bus"
```

### Example 2: Network Firewall (Palo Alto, Checkpoint, Fortinet)

Create outbound security rules:

```text
Rule Name: Allow-AMQP-to-Azure-ServiceBus
Action: Allow
Source: [Agent Server Subnet]
Destination: *.servicebus.windows.net
Service: TCP 5671, 5672
Logging: Enabled
Description: AMQP traffic for Azure Service Bus Monitoring
```

### Example 3: Azure Network Security Group (NSG)

Configure NSG on the agent's subnet (if agent is in Azure):

```powershell
# Create NSG rule for outbound AMQP
$nsgRule = New-AzNetworkSecurityRuleConfig `
  -Name "AllowAMQPToServiceBus" `
  -Protocol Tcp `
  -SourcePortRange "*" `
  -DestinationPortRange "5671,5672" `
  -SourceAddressPrefix "*" `
  -DestinationAddressPrefix "*" `
  -Access Allow `
  -Priority 100 `
  -Direction Outbound

# Add rule to NSG
$nsg = Get-AzNetworkSecurityGroup -ResourceGroupName "rg-name" -Name "nsg-name"
$nsg | Add-AzNetworkSecurityRuleConfig @nsgRule | Set-AzNetworkSecurityGroup
```

## Troubleshooting AMQP Connectivity Issues

### Symptom: "Connection Refused" on Port 5671/5672

#### Likely Causes

* Firewall rule not applied or syntax error
* NSG rule blocking traffic
* Corporate proxy intercepting connections
* Antivirus software blocking AMQP protocol

#### Resolution

1. Verify firewall rule created successfully: `Get-NetFirewallRule -DisplayName "Allow AMQP to Azure Service Bus"`
2. Test from command line: `Test-NetConnection -ComputerName [service-bus-name].servicebus.windows.net -Port 5671 -Verbose`
3. Review firewall logs for blocked connections
4. Consult network team if behind corporate proxy
5. Verify antivirus/EDR software isn't blocking connections

### Symptom: "Connection Timeout" After Initial Connection

#### Likely Causes

* Firewall rule only allows port 443 (HTTPS), not AMQP ports
* Network path asymmetry (outbound allowed, inbound blocked)
* Azure Service Bus namespace not found or misconfigured

#### Resolution

1. Verify both ports 5671 AND 5672 are allowed in firewall
2. Ensure return traffic on same ports is allowed (stateful firewall inspection)
3. Verify Service Bus namespace name is correct: `Test-NetConnection -ComputerName [namespace].servicebus.windows.net -Port 443`

### Symptom: "Authentication Failed" on Successful Connection

#### Likely Causes

* Application registration doesn't have `Azure Service Bus Data Owner` role
* Entra ID application credentials expired
* Tenant ID or Client ID misconfigured in agent settings

#### Resolution

1. Verify role assignment: `Get-AzRoleAssignment -ObjectId [application-object-id] -Scope /subscriptions/[subscription-id]/resourceGroups/[rg]/providers/Microsoft.ServiceBus/namespaces/[namespace]`
2. Verify application credentials in agent configuration match Entra ID registration
3. Test Entra ID authentication independently if available

## AMQP vs HTTPS: When to Use Each

| Scenario | AMQP (5671/5672) | HTTPS (443) | Recommendation |
|----------|------------------|------------|-----------------|
| Continuous monitoring (24/7) | ✅ Better | ⚠️ More polling | Use AMQP |
| High message throughput (1000+/min) | ✅ Optimized | ⚠️ Limited by REST | Use AMQP |
| Firewall allows only 443 | ❌ No | ✅ Yes | Use HTTPS |
| Intermittent queries | ✅ Works | ✅ Works | Either is fine |
| Legacy system compatibility | ❌ No | ✅ Universal | Use HTTPS |
| Lowest latency required | ✅ Better | ⚠️ Adds overhead | Use AMQP |

**Default Recommendation:** Allow both 443 and 5671/5672. AMQP needs 5671 (and 5672 if used), and 443 is always needed for token requests to Microsoft Entra ID and for HTTPS calls to the namespace.

## Azure Service Bus FAQ Reference

For additional Azure Service Bus networking details, see [Microsoft Learn - Azure Service Bus FAQ](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-faq#what-ports-do-i-need-to-open-on-the-firewall--)<sup><i class="fal fa-arrow-up-right-from-square" aria-hidden="true"></i></sup>.

## <i class="fal fa-hand-point-right" aria-hidden="true"></i> Next Steps

After confirming AMQP port connectivity:

* [Configure Message Queueing Monitoring Agent][] for Service Bus integration  
* [Configure Azure Logic Apps Monitoring Agent][] for Event Hub integration  
* [Configure Service Bus Relaying][] for hybrid/distributed monitoring scenarios  

## <i class="fal fa-link-horizontal" aria-hidden="true"></i> Related Topics

* [Azure Application Access][]  
* [Azure Application Access - Least Privileges][AzureApplicationsAccessLP]  
* [Azure Role Deployment Automation][]  
* [Monitoring Service firewall settings][FW Monitoring Service]  

[Azure Application Access]:https://docs.nodinite.com/install-and-update/troubleshooting/azure/azure-application-access/
[Azure Role Deployment Automation]:https://docs.nodinite.com/install-and-update/troubleshooting/azure/azure-role-deployment-automation/
[Azure Service Bus]:https://docs.nodinite.com/logging-and-monitoring/message-queueing/features/azure-service-bus-queues/monitoring-azure-service-bus-queue/
[AzureApplicationsAccessLP]:https://docs.nodinite.com/install-and-update/troubleshooting/azure/azure-application-access-least-privileges/
[Configure Azure Logic Apps Monitoring Agent]:https://docs.nodinite.com/logging-and-monitoring/azure-logic-apps/getting-started/prerequisites/
[Configure Message Queueing Monitoring Agent]:https://docs.nodinite.com/logging-and-monitoring/message-queueing/getting-started/prerequisites/
[Configure Service Bus Relaying]:https://docs.nodinite.com/install-and-update/troubleshooting/configure-service-bus-relaying-for-monitor-agents/
[FW Logic Apps Azure]:https://docs.nodinite.com/logging-and-monitoring/azure-logic-apps/getting-started/prerequisites/firewall-settings/#between-the-logic-apps-agent-and-azure
[FW Monitoring Service]:https://docs.nodinite.com/core-services/monitoring-service/getting-started/prerequisites/#fa-shield-check-what-firewall-settings-are-required-for-the-monitoring-service
[FW MQ ASB]:https://docs.nodinite.com/logging-and-monitoring/message-queueing/getting-started/prerequisites/#between-the-message-queueing-monitoring-agent-and-azure-service-bus
[Logic Apps Event Hubs]:https://docs.nodinite.com/logging-and-monitoring/azure-logic-apps/getting-started/configuration-event-hubs/
[LogicAppsAgent]:https://docs.nodinite.com/logging-and-monitoring/azure-logic-apps/overview/
[Message Queuing Agent]:https://docs.nodinite.com/logging-and-monitoring/message-queueing/overview/
[Monitoring Agents]:https://docs.nodinite.com/administration/monitor-management/monitor-agents/features/what-is-a-monitor-agent/
[Pickup EventHub]:https://docs.nodinite.com/logging-and-monitoring/pickup-logevents-service/features/configurations/eventhub/