|
| 1 | +--- |
| 2 | +title: Associate Azure Batch accounts with network security perimeter |
| 3 | +description: Learn how to associate an Azure Batch account with network security perimeter |
| 4 | +ms.topic: how-to |
| 5 | +ms.date: 3/17/2025 |
| 6 | +ms.custom: references_regions |
| 7 | +--- |
| 8 | + |
| 9 | +# Associate Azure Batch accounts with network security perimeter |
| 10 | + |
| 11 | +The [network security perimeter (NSP)](../private-link/network-security-perimeter-concepts.md) provided by Azure networking serves as a comprehensive tool for customers to ensure optimal security when utilizing PaaS resources. It allows customers to establish logical boundaries for network isolation and collectively manage public access controls for numerous PaaS resources. |
| 12 | + |
| 13 | +With a network security perimeter: |
| 14 | + - PaaS resources associated with a specific perimeter are, by default, only able to communicate with other PaaS resources within the same perimeter. |
| 15 | + - Explicit access rules can actively permit external inbound and outbound communication. |
| 16 | + - [Diagnostic Logs](../private-link/network-security-perimeter-diagnostic-logs.md) are enabled for PaaS resources within perimeter for Audit and Compliance. |
| 17 | + |
| 18 | +> [!IMPORTANT] |
| 19 | +> Network security perimeter rules do not govern the private link with the [private endpoint](../private-link/private-endpoint-overview.md). |
| 20 | +
|
| 21 | +## Network security perimeter scenarios in Batch service |
| 22 | + |
| 23 | +Azure Batch service is designed to support various scenarios that necessitate access to other PaaS resources: |
| 24 | + |
| 25 | + - Application packages require communication with Azure Storage. For more information, see [batch-application-packages](./batch-application-packages.md). |
| 26 | + - Customer managed key requires communication with Azure KeyVault. For more information, see [batch-customer-managed-key](./batch-customer-managed-key.md). |
| 27 | + |
| 28 | +Network administrators can use the network security perimeter feature to create an isolation boundary for their PaaS services. This security perimeter permits the setting up of public access controls for various PaaS resources, providing a consistent user experience and a uniform API. Setting up network security perimeter for PaaS communications supported by Batch, refer to the [Network security perimeter in Azure Storage](/azure/storage/common/storage-network-security#network-secuirty-perimeter-preview) and [Network security perimeter in Azure Key Vault](/azure/key-vault/general/network-security#network-security-perimeter-preview) for more details. |
| 29 | + |
| 30 | +Network security perimeter provides several methods to enable Batch to interact with other PaaS services if the target PaaS service is in network security perimeter: |
| 31 | + - Associate the Batch account with the same perimeter as the target resource and assign the necessary permissions to the Managed Identity used across these resources. |
| 32 | + - Create the profile with appropriate inbound access rules (for example, creating an inbound access rule for the Batch account's fully qualified domain name) and apply it to the target PaaS resource. This profile is used to evaluate inbound traffic (sent from Batch) from outside the perimeter traffic. |
| 33 | + |
| 34 | +Batch users can also use the network security perimeter to secure inbound traffic, not just the outbound traffic scenarios with Azure Storage and Azure Key Vault. |
| 35 | + |
| 36 | +> [!NOTE] |
| 37 | +> Network security perimeters do not regulate nodes within Batch pools. To ensure network isolation for the pool, you may still need to create a **nodeManagement** private endpoint for [the Batch pool without public ip addresses](./simplified-node-communication-pool-no-public-ip.md). |
| 38 | +> To enable a node to access Azure Storage and other PaaS resources associated with a network security perimeter, ensure that relevant access rules are added to the target PaaS resource's profile. These access rules grant the node the necessary permissions to visit. |
| 39 | +
|
| 40 | +## Configure network security perimeter for Azure Batch account |
| 41 | + |
| 42 | +### Prerequisite |
| 43 | + |
| 44 | +1. Set up your Batch account by using a user-assigned managed identity. |
| 45 | +2. It's optional but recommended to change the public network access of your Batch account to `SecuredByPerimeter`. |
| 46 | + |
| 47 | + This public network access value guarantees that the resource's inbound and outbound connectivity is restricted to resources within the same perimeter. The associated perimeter profile sets the rules that control public access. |
| 48 | + |
| 49 | + This Batch account modification can be made using the [Batch management Account API](/rest/api/batchmanagement/batch-account/update?#publicnetworkaccesstype) or [SDK BatchPublicNetworkAccess Enum value](/dotnet/api/azure.resourcemanager.batch.models.batchpublicnetworkaccess). |
| 50 | + |
| 51 | +3. Make sure your Batch account operates only with the simplified node communication pool. |
| 52 | + |
| 53 | +### Create a network security perimeter |
| 54 | + |
| 55 | +Create your own network security perimeter resource using [Azure portal](../private-link/create-network-security-perimeter-portal.md) or [PowerShell](../private-link/create-network-security-perimeter-powershell.md) or [Azure CLI](../private-link/create-network-security-perimeter-cli.md). |
| 56 | + |
| 57 | +### Associate Batch account with the network security perimeter |
| 58 | + |
| 59 | +#### Using Azure portal |
| 60 | +1. Navigate to your network security perimeter resource in the Azure portal, where you should establish a profile for your Batch account to associate with. If you do not create the profile, go to **Settings** -> **Profiles** to create a network security perimeter profile initially. |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +2. In **Overview**, select the third option **Associate resources to your profile** |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +3. Associate resources with a new profile or associate resources with an existing profile |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +#### Using PowerShell |
| 73 | +1. Create a new profile for your network security perimeter |
| 74 | + |
| 75 | + ```azurepowershell-interactive |
| 76 | + # Create a new profile |
| 77 | + $nspProfile = @{ |
| 78 | + Name = '<ProfileName>' |
| 79 | + ResourceGroupName = '<ResourceGroupName>' |
| 80 | + SecurityPerimeterName = '<NetworkSecurityPerimeterName>' |
| 81 | + } |
| 82 | + |
| 83 | + $profile = New-AzNetworkSecurityPerimeterProfile @nspProfile |
| 84 | + ``` |
| 85 | +
|
| 86 | +2. Associate the Batch account with the network security perimeter profile |
| 87 | +
|
| 88 | + ```azurepowershell-interactive |
| 89 | + # Associate the PaaS resource with the above created profile |
| 90 | + $nspAssociation = @{ |
| 91 | + AssociationName = '<AssociationName>' |
| 92 | + ResourceGroupName = '<ResourceGroupName>' |
| 93 | + SecurityPerimeterName = '<NetworkSecurityPerimeterName>' |
| 94 | + AccessMode = 'Learning' |
| 95 | + ProfileId = '<NetworkSecurityPerimeterProfileId>' |
| 96 | + PrivateLinkResourceId = '<BatchAccountResourceId>' |
| 97 | + } |
| 98 | + |
| 99 | + New-AzNetworkSecurityPerimeterAssociation @nspAssociation | format-list |
| 100 | + ``` |
| 101 | +
|
| 102 | +#### Using Azure CLI |
| 103 | +
|
| 104 | +1. Create a new profile for your network security perimeter with the following command: |
| 105 | +
|
| 106 | + ```azurecli-interactive |
| 107 | + # Create a new profile |
| 108 | + az network perimeter profile create \ |
| 109 | + --name <ProfileName> \ |
| 110 | + --resource-group <ResourceGroupName> \ |
| 111 | + --perimeter-name <NetworkSecurityPerimeterName> |
| 112 | +
|
| 113 | + ``` |
| 114 | +
|
| 115 | +2. Associate the Batch account (PaaS resource) with the network security perimeter profile with the following commands. |
| 116 | +
|
| 117 | + ```azurecli-interactive |
| 118 | + # Get the profile id |
| 119 | + az network perimeter profile show \ |
| 120 | + --name <ProfileName> \ |
| 121 | + --resource-group <ResourceGroupName> \ |
| 122 | + --perimeter-name <NetworkSecurityPerimeterName> |
| 123 | + |
| 124 | + # Associate the Batch account with the network security perimeter profile |
| 125 | + # Replace <PaaSArmId> and <NetworkSecurityPerimeterProfileId> with the values for your Batch account resource id and profile |
| 126 | + az network perimeter association create \ |
| 127 | + --name <NetworkSecurityPerimeterAssociationName> \ |
| 128 | + --perimeter-name <NetworkSecurityPerimeterName> \ |
| 129 | + --resource-group <ResourceGroupName> \ |
| 130 | + --access-mode Learning \ |
| 131 | + --private-link-resource "{id:<PaaSArmId>}" \ |
| 132 | + --profile "{id:<NetworkSecurityPerimeterProfileId>}" |
| 133 | + |
| 134 | + ``` |
| 135 | +
|
| 136 | +## Next steps |
| 137 | +
|
| 138 | +- Learn more about [Security Best Practices in Azure Batch](security-best-practices.md). |
| 139 | +- Learn more about [Network Security Perimeter Concepts](../private-link/network-security-perimeter-concepts.md). |
| 140 | +- Learn more about [Network Security Perimeter Diagnostic Logs](../private-link/network-security-perimeter-diagnostic-logs.md). |
| 141 | +- Learn more about [Network Security Perimeter Role Based Access Control](../private-link/network-security-perimeter-role-based-access-control-requirements.md). |
| 142 | +- Learn more about [Network Security Perimeter Transition](../private-link/network-security-perimeter-transition.md). |
0 commit comments