|
| 1 | +--- |
| 2 | +title: Associate Network Security Perimeter With Event Hubs |
| 3 | +description: Discover step-by-step instructions to associate a network security perimeter with your Azure Event Hubs namespace and secure your data streams. |
| 4 | +#customer intent: As an IT professional, I want to verify the association of a network security perimeter with my Event Hubs namespace so that I can ensure proper configuration. |
| 5 | +ms.topic: how-to |
| 6 | +ms.date: 01/31/2026 |
| 7 | +--- |
| 8 | + |
| 9 | +# Associate network security perimeter (NSP) with an Azure Event Hubs namespace |
| 10 | + |
| 11 | +You can associate a network security perimeter (NSP) with an Azure Event Hubs namespace to enhance the security of your event streaming infrastructure. This association restricts access to the Event Hubs namespace based on the defined security perimeter, allowing you to: |
| 12 | + |
| 13 | +- Control which Azure resources can communicate with your Event Hubs namespace. |
| 14 | +- Define inbound and outbound access rules for your event streaming workloads. |
| 15 | +- Monitor and audit network access to your Event Hubs resources. |
| 16 | + |
| 17 | +> [!NOTE] |
| 18 | +> For conceptual information, see [Network security perimeter for Azure Event Hubs](network-security-perimeter.md). |
| 19 | +
|
| 20 | +## Prerequisites |
| 21 | + |
| 22 | +Before you begin, ensure you have the following prerequisites in place: |
| 23 | + |
| 24 | +- An existing Azure Event Hubs namespace. |
| 25 | +- An existing network security perimeter (NSP) in your Azure subscription. If you don't have one, [create a network security perimeter](/azure/private-link/create-network-security-perimeter-portal) first. |
| 26 | +- A profile configured within the NSP to associate with your Event Hubs namespace. |
| 27 | +- The **Contributor** role or higher on the Event Hubs namespace. |
| 28 | +- The **Network Security Perimeter Contributor** role or higher on the NSP. |
| 29 | + |
| 30 | +## Associate NSP with an Azure Event Hubs namespace |
| 31 | + |
| 32 | +Follow these steps to associate an NSP with your Event Hubs namespace using the Azure portal: |
| 33 | + |
| 34 | +1. Sign in to the [Azure portal](https://portal.azure.com/). |
| 35 | +1. In the search box, enter **Event Hubs**, and then select **Event Hubs** from the search results. |
| 36 | +1. Select your Event Hubs namespace from the list. |
| 37 | +1. In the left-hand menu under **Settings**, select **Networking**. |
| 38 | +1. Select the **Public access** tab. |
| 39 | +1. Under the **Network security perimeter** section, select **Associate NSP**. |
| 40 | + |
| 41 | + :::image type="content" source="./media/associate-network-security-perimeter/associate-button.png" alt-text="Screenshot of the Networking page with Associate button for network security perimeter selected." lightbox="./media/associate-network-security-perimeter/associate-button.png"::: |
| 42 | +1. In the **Associate network security perimeter** page, complete the following configuration: |
| 43 | + |
| 44 | + | Setting | Description | |
| 45 | + | --- | --- | |
| 46 | + | **Network security perimeter** | Select the NSP you want to associate from the dropdown list. Only NSPs in the same region as your Event Hubs namespace are available. | |
| 47 | + | **Profile** | Select the profile within the NSP to associate with the Event Hubs namespace. Profiles contain the access rules that apply to associated resources. | |
| 48 | + |
| 49 | +1. Select **Associate** to complete the association. |
| 50 | + |
| 51 | + :::image type="content" source="./media/associate-network-security-perimeter/associate-network-security-perimeter-page.png" alt-text="Screenshot of the Associate a network security perimeter page." lightbox="./media/associate-network-security-perimeter/associate-network-security-perimeter-page.png"::: |
| 52 | + |
| 53 | +1. Wait for the association to complete. The process typically takes a few minutes. |
| 54 | +1. Once the association is complete, verify that the NSP appears under the **Network security perimeter** section of your Event Hubs namespace. |
| 55 | + |
| 56 | + :::image type="content" source="./media/associate-network-security-perimeter/public-access-page.png" alt-text="Screenshot of the Public access page with the network security perimeter selected." lightbox="./media/associate-network-security-perimeter/public-access-page.png"::: |
| 57 | + |
| 58 | +## Manage NSP settings |
| 59 | + |
| 60 | +After associating the NSP with your Event Hubs namespace, you can manage and configure the security settings. |
| 61 | + |
| 62 | +### View and modify NSP configuration |
| 63 | + |
| 64 | +1. On the **Networking** page of your Event Hubs namespace, select **Manage** in the **Network security perimeter** section. |
| 65 | + |
| 66 | + :::image type="content" source="./media/associate-network-security-perimeter/manage-button.png" alt-text="Screenshot of the Public access page with Manage button highlighted in the network security perimeter section." lightbox="./media/associate-network-security-perimeter/manage-button.png"::: |
| 67 | + |
| 68 | +1. Review the inbound and outbound access rules configured for the NSP. These rules determine what traffic is allowed to and from your Event Hubs namespace. |
| 69 | + |
| 70 | + :::image type="content" source="./media/associate-network-security-perimeter/associate-inbound-outbound-rules.png" alt-text="Screenshot of the Network security perimeter configuration page." lightbox="./media/associate-network-security-perimeter/associate-inbound-outbound-rules.png"::: |
| 71 | +1. To add or modify inbound and outbound rules: |
| 72 | + 1. Navigate to the NSP configuration page by selecting the **NSP name** at the top of the page. |
| 73 | + 1. In the NSP configuration, you can: |
| 74 | + - Add **inbound access rules** to allow specific external resources or IP addresses to access your Event Hubs namespace. |
| 75 | + - Add **outbound access rules** to allow your Event Hubs namespace to communicate with external resources. |
| 76 | + - Modify or delete existing rules as needed. |
| 77 | + |
| 78 | + > [!TIP] |
| 79 | + > When configuring access rules, follow the principle of least privilege by only allowing the minimum required access for your workloads. |
| 80 | +
|
| 81 | +### Assign a managed identity |
| 82 | + |
| 83 | +To use managed identity with your NSP-associated Event Hubs namespace: |
| 84 | + |
| 85 | +1. In the **Associate resource** section, select **Manage** for **Identity**. |
| 86 | + |
| 87 | + :::image type="content" source="./media/associate-network-security-perimeter/assign-managed-identity-link.png" alt-text="Screenshot of the Network security perimeter configuration page with the Manage button for the Identity is highlighted." lightbox="./media/associate-network-security-perimeter/assign-managed-identity-link.png"::: |
| 88 | + |
| 89 | +1. Follow the steps in [Enable managed identity for Event Hubs](enable-managed-identity.md) to assign a system-assigned or user-assigned managed identity to your namespace. |
| 90 | + |
| 91 | +## Verify the association |
| 92 | + |
| 93 | +After completing the association, perform these verification steps: |
| 94 | + |
| 95 | +1. **Test connectivity**: Verify that the Event Hubs namespace is accessible only from resources within the defined network security perimeter. |
| 96 | + - Attempt to connect from a resource inside the perimeter (should succeed). |
| 97 | + - Attempt to connect from a resource outside the perimeter (should be blocked unless allowed by access rules). |
| 98 | +1. **Review diagnostic logs**: Enable diagnostic logging for your Event Hubs namespace to monitor connection attempts and identify any access issues. |
| 99 | +1. **Validate application functionality**: Ensure that your applications can still send and receive events as expected. |
| 100 | + |
| 101 | +## Best practices |
| 102 | + |
| 103 | +Follow these best practices when using NSP with Event Hubs: |
| 104 | + |
| 105 | +- **Plan your perimeter**: Before you associate an NSP, map out all the resources that need to communicate with your Event Hubs namespace. |
| 106 | +- **Use profiles effectively**: Create separate profiles for different environments (development, staging, production) to apply appropriate access rules. |
| 107 | +- **Monitor regularly**: Set up alerts and regularly review access logs to detect unauthorized access attempts. |
| 108 | +- **Keep rules updated**: As your infrastructure changes, update your NSP rules to reflect new requirements while maintaining security. |
| 109 | +- **Test changes**: Before applying NSP changes in production, test them in a nonproduction environment. |
| 110 | + |
| 111 | +## Troubleshooting |
| 112 | + |
| 113 | +If you encounter issues after associating an NSP with your Event Hubs namespace: |
| 114 | + |
| 115 | +| Issue | Possible cause | Solution | |
| 116 | +| --- | --- | --- | |
| 117 | +| Applications can't connect to Event Hubs | NSP is blocking the traffic | Add an inbound access rule to allow traffic from your application's network. | |
| 118 | +| Event Hubs can't send data to downstream services | Outbound rules are too restrictive | Add an outbound access rule to allow traffic to the required destination. | |
| 119 | +| NSP doesn't appear in the dropdown list | NSP is in a different region | Create an NSP in the same region as your Event Hubs namespace. | |
| 120 | +| Association fails | Insufficient permissions | Verify you have the required roles on both the Event Hubs namespace and the NSP. | |
| 121 | + |
| 122 | +## Related content |
| 123 | + |
| 124 | +- [Network security perimeter for Azure Event Hubs](network-security-perimeter.md) |
| 125 | +- [Azure network security perimeter concepts](/azure/private-link/network-security-perimeter-concepts) |
| 126 | +- [Create a network security perimeter](/azure/private-link/create-network-security-perimeter-portal) |
0 commit comments