|
| 1 | +--- |
| 2 | +title: Create a Network Security Perimeter |
| 3 | +titleSuffix: An Azure Communication Services article |
| 4 | +description: This article describes how to create and manage your network security perimeter with Azure Communication Services. |
| 5 | +author: harazi |
| 6 | +manager: sundraman |
| 7 | +services: azure-communication-services |
| 8 | +ms.author: harazi |
| 9 | +ms.date: 04/21/2025 |
| 10 | +ms.topic: quickstart |
| 11 | +ms.service: azure-communication-services |
| 12 | +ms.subservice: arm |
| 13 | +zone_pivot_groups: acs-plat-azp-azcli-net-ps |
| 14 | +ms.custom: mode-other, devx-track-azurecli, devx-track-azurepowershell |
| 15 | +ms.devlang: azurecli |
| 16 | +--- |
| 17 | + |
| 18 | +# Create a Network Security Perimeter |
| 19 | + |
| 20 | +This article provides a comprehensive guide to set up a Network Security Perimeter (NSP) with Azure Communication Services. The NSP ensures that your communication services are secure and protected from unauthorized access. |
| 21 | + |
| 22 | +## Prerequisites |
| 23 | + |
| 24 | +- An active Azure subscription. |
| 25 | + |
| 26 | +- The latest Azure CLI. This article requires [Azure CLI version 2.38.0 or later](/cli/azure/install-azure-cli-windows). |
| 27 | + |
| 28 | +- After installing or upgrading to the latest version of Azure CLI, import the network security perimeter commands using: |
| 29 | + |
| 30 | + `az extension add –name nsp` |
| 31 | + |
| 32 | +- Import the Azure communications commands using: |
| 33 | + |
| 34 | + `az extension add --name communication` |
| 35 | + |
| 36 | +## Set up your Network Security Perimeter for Email |
| 37 | + |
| 38 | +### Step 1: Share the subscription ID to test NSP |
| 39 | + |
| 40 | +Complete and submit the form at [Network Security Perimeter for Azure Communication Services](https://aka.ms/acs-nsp). You need to provide a company name, subscription ID, and scenario. |
| 41 | + |
| 42 | +1. Register for the Azure Network Security Perimeter public preview. To register, add the `AllowNSPInPublicPreview` feature flag to your subscription. |
| 43 | + |
| 44 | + :::image type="content" source="media/allow-network-security-perimeter-public-preview.png" alt-text="Screen capture of Preview features page showing AllowNSPInPublicPreview for Azure Subscription and the display name Feature flag to approve creation of Network Security Perimeter."::: |
| 45 | + |
| 46 | + For more information on adding feature flags, see [Set up preview features in Azure subscription](/azure/azure-resource-manager/management/preview-features). |
| 47 | + |
| 48 | +2. After adding the feature flag, you need to re-register the `Microsoft.Network` resource provider in your subscription. |
| 49 | + |
| 50 | + `az provider register --namespace Microsoft.Network` |
| 51 | + |
| 52 | +### Step 2: Create a new resource or update an existing Azure Communication Services resource using Azure CLI/Cloud Shell |
| 53 | + |
| 54 | +Use the following command to set `PublicNetworkAccess` to `SecuredByPerimeter`. |
| 55 | + |
| 56 | +`az rest --method PUT --uri https://management.azure.com/subscriptions/<subscription ID>/resourceGroups/<resource-group-name> /providers/Microsoft.Communication/communicationServices/<acs-resource name>?api-version=2023-12-25-preview --body "{'location': 'Global', 'properties': {'dataLocation': ''<acs-datalocation>, 'publicNetworkAccess': 'SecuredByPerimeter',}}"` |
| 57 | + |
| 58 | +### Step 3: Create a network security perimeter |
| 59 | + |
| 60 | +`az network perimeter create --name <network-security-perimeter-name> --resource-group <resource-group-name> -l <location>` |
| 61 | + |
| 62 | +### Step 4: Create a new profile for the perimeter |
| 63 | + |
| 64 | +Provide the same network security perimeter name used in **Step 3**. |
| 65 | + |
| 66 | +`az network perimeter profile create --name <network-perimeter-profile-name> --resource-group <resource-group-name> --perimeter-name <network-security-perimeter-name>` |
| 67 | + |
| 68 | +### Step 5: Create an inbound access rule with a public IP address [YC2.1] [YC2.2] prefix for the profile created with the following command |
| 69 | + |
| 70 | +`az network perimeter profile access-rule create --name <access-rule-name> --profile-name <network-perimeter-profile-name> --perimeter-name <network-security-perimeter-name> --resource-group <resource-group-name> --address-prefixes "[192.0.2.0/24]"` |
| 71 | + |
| 72 | +> [!NOTE] |
| 73 | +> |
| 74 | +> NSP currently supports only IPV4 addresses. Use Microsoft Classless Inter-Domain Routing (CIDR), not just one IP address. For more information, see [Understanding CIDR Notation when designing Azure Virtual Networks and Subnets](https://devblogs.microsoft.com/premier-developer/understanding-cidr-notation-when-designing-azure-virtual-networks-and-subnets/). |
| 75 | +
|
| 76 | +### Step 6: Associate the Azure Communication Services (PaaS resource) with the network security perimeter profile with the following commands |
| 77 | + |
| 78 | +1. Get your Azure Communication Services resource ID. |
| 79 | + |
| 80 | + `az communication show --name <acs-resource-name> --resource-group <acs-resource-group> --query 'id'` |
| 81 | + |
| 82 | +2. Get the profile ID. |
| 83 | + |
| 84 | + `az network perimeter profile show --name <network-perimeter-profile-name> --resource-group <network-perimeter-resource-group> --perimeter-name <network-security-perimeter-name> --query 'id'` |
| 85 | + |
| 86 | +3. Associate your Azure Communication Services resource with the network security perimeter. |
| 87 | + |
| 88 | + Replace `<ACSArmId>` and `<networkSecurityPerimeterProfileId>` with the ID values for your ACS and profile |
| 89 | + |
| 90 | + `az network perimeter association create --name <network-perimeter-association-name> --perimeter-name <network-security-perimeter-name> --resource-group <network-perimeter-resource-group> --access-mode Enforced --private-link-resource "{id:<ACSArmId>}" --profile "{id:<networkSecurityPerimeterProfileId>}"` |
| 91 | + |
| 92 | + |
| 93 | +### Step 7: Verify the allowlisted IP addresses can send email with NSP enabled [YC3.1] [YC3.2] [NM3.3] |
| 94 | + |
| 95 | +Make sure that the Azure Communication Services resource is connected to a verified email domain. For more information, see [Connect a verified email domain](./email/connect-email-communication-resource.md). |
| 96 | + |
| 97 | +You can send email by using `Try Email` feature on Azure portal or run the following command with your domain name and Azure Communication Services resource connection string. |
| 98 | + |
| 99 | +`az communication email send --connection-string "<Connection-string>" --sender "[email protected]" --to "<Recipient-email>" --subject "Welcome to Azure Communication Services Email" --text "Test Email"` |
0 commit comments