|
| 1 | +--- |
| 2 | +title: Configure Network Security Perimeter for Azure Batch accounts |
| 3 | +description: Learn how to associate an Azure Batch account with Network Seucirty Perimeter |
| 4 | +ms.topic: how-to |
| 5 | +ms.date: 2/27/2025 |
| 6 | +ms.custom: references_regions |
| 7 | +--- |
| 8 | + |
| 9 | +# 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 | + - By utilizing explicit access rules, exceptions can be made for 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 | +> Private link with the [private endpoint](../private-link/private-endpoint-overview.md) will not be governed by network security perimeter rules. |
| 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**: This requires communication with Azure Storage. For additional details, please refer to [batch-application-packages](./batch-application-packages.md). |
| 26 | + - **Customer-managed Keys**: This requires communication with Azure KeyVault. For additional details, please refer to [batch-customer-managed-key](./batch-customer-managed-key.md). |
| 27 | + |
| 28 | +By onboarding network security perimeter, network administrators can establish a network isolation boundary for their PaaS services. This allows for the configuration of public access controls for multiple PaaS resources through a uniform API and a consistent user experience. |
| 29 | + |
| 30 | +For the PaaS communications supported by Batch as mentioned above, network security perimeter provides several methods to enable Batch to interact with other PaaS services: |
| 31 | + - Associate the target PaaS resource with the same perimeter as the Batch account and assign the necessary RBAC permissions to the Managed Identity used across these resources. |
| 32 | + - Create the profile with appropriate inbound access rules (e.g., whitelist the Batch account's fully qualified domain name) and apply it to the target PaaS resource. This profile will be used to evaluate inbound traffic (sent from Batch) from outside the perimeter traffic. |
| 33 | + |
| 34 | +Please note that Batch users can also use the network security perimeter to secure inbound traffic, not just the outbound traffic scenarios outlined above. |
| 35 | + |
| 36 | +> [!NOTE] |
| 37 | +> Nodes within Batch pools are not regulated by network security perimeters. 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. This will grant the node the necessary permissions to visit. |
| 39 | +
|
| 40 | +# Configure Network Security Perimeter for Azure Batch account |
| 41 | + |
| 42 | +## Prerequiste |
| 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 guarantees that both inbound and outbound connectivity of the resource is restricted to those within the same perimeter, and public access is governed by the access rules determined by the related perimeter profile. |
| 48 | + |
| 49 | + This Batch account modification can be made using the [Batch management Account API](https://learn.microsoft.com/en-us/rest/api/batchmanagement/batch-account/update?view=rest-batchmanagement-2024-07-01&tabs=HTTP#publicnetworkaccesstype). |
| 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 in the Azure portal, where you should have established a profile for your Batch account to associate with. If you haven't done so yet, please proceed 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 | + |
| 78 | + $nspProfile = @{ |
| 79 | + Name = 'nsp-profile' |
| 80 | + ResourceGroupName = $rgParams.name |
| 81 | + SecurityPerimeterName = $nsp.name |
| 82 | + } |
| 83 | + |
| 84 | + $profile = New-AzNetworkSecurityPerimeterProfile @nspProfile |
| 85 | + ``` |
| 86 | +
|
| 87 | +2. Associate the Batch account with the network security perimeter profile |
| 88 | +
|
| 89 | + ```azurepowershell-interactive |
| 90 | + # Associate the PaaS resource with the above created profile |
| 91 | + |
| 92 | + $nspAssociation = @{ |
| 93 | + AssociationName = 'nsp-association' |
| 94 | + ResourceGroupName = $rgParams.name |
| 95 | + SecurityPerimeterName = $nsp.name |
| 96 | + AccessMode = 'Learning' |
| 97 | + ProfileId = $Profile.Id |
| 98 | + PrivateLinkResourceId = $batchAccount.ResourceID |
| 99 | + } |
| 100 | + |
| 101 | + New-AzNetworkSecurityPerimeterAssociation @nspAssociation | format-list |
| 102 | + ``` |
| 103 | +
|
| 104 | +### Using Azure CLI |
| 105 | +
|
| 106 | +1. Create a new profile for your network security perimeter with the following command: |
| 107 | +
|
| 108 | + ```azurecli-interactive |
| 109 | + # Create a new profile |
| 110 | + az network perimeter profile create \ |
| 111 | + --name network-perimeter-profile \ |
| 112 | + --resource-group resource-group \ |
| 113 | + --perimeter-name network-security-perimeter |
| 114 | +
|
| 115 | + ``` |
| 116 | +
|
| 117 | +2. Associate the Batch account (PaaS resource) with the network security perimeter profile with the following commands. |
| 118 | +
|
| 119 | + ```azurecli-interactive |
| 120 | + |
| 121 | + # Get key vault id |
| 122 | + az keyvault show \ |
| 123 | + --name $key_vault_name \ |
| 124 | + --resource-group resource-group \ |
| 125 | + --query 'id' |
| 126 | + |
| 127 | + # Get the profile id |
| 128 | + az network perimeter profile show \ |
| 129 | + --name network-perimeter-profile \ |
| 130 | + --resource-group resource-group \ |
| 131 | + --perimeter-name network-security-perimeter |
| 132 | + |
| 133 | + # Associate the Azure Key Vault with the network security perimeter profile |
| 134 | + # Replace <PaaSArmId> and <networkSecurityPerimeterProfileId> with the ID values for your Batch account and profile |
| 135 | + az network perimeter association create \ |
| 136 | + --name network-perimeter-association \ |
| 137 | + --perimeter-name network-security-perimeter \ |
| 138 | + --resource-group resource-group \ |
| 139 | + --access-mode Learning \ |
| 140 | + --private-link-resource "{id:<PaaSArmId>}" \ |
| 141 | + --profile "{id:<networkSecurityPerimeterProfileId>}" |
| 142 | + |
| 143 | + ``` |
| 144 | +
|
| 145 | +## Next steps |
| 146 | +
|
| 147 | +- Learn more about [security best practices in Azure Batch](security-best-practices.md). |
| 148 | +- Learn more about [Network Security Perimeter Concepts](../private-link/network-security-perimeter-concepts.md). |
| 149 | +- Learn more about [Network Security Perimeter Diagnostic Logs](../private-link/network-security-perimeter-diagnostic-logs.md). |
| 150 | +- Learn more about [Network Security Perimeter Role Based Access Control](../private-link/network-security-perimeter-role-based-access-control-requirements.md). |
| 151 | +- Learn more about [Network Security Perimeter Transition](../private-link/network-security-perimeter-transition.md). |
0 commit comments