You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-network-manager/enforce-vnet-create-azure-policy.md
+21-18Lines changed: 21 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Prevent overlapping VNet address spaces using Azure Policy and IPAM
2
+
title: Prevent overlapping virtual network address spaces using Azure Policy and IPAM
3
3
description:
4
4
author: mbender-ms
5
5
ms.author: mbender
@@ -9,16 +9,11 @@ ms.date: 03/10/2023
9
9
ms.custom: template-concept
10
10
---
11
11
12
-
# Prevent overlapping VNet address spaces using Azure Policy and IPAM
12
+
# Prevent overlapping virtual network address spaces using Azure Policy and IPAM
13
13
14
-
Azure Virtual Network Manager helps you centrally manage virtual networks (VNets) across your organization. While it provides governance for VNets, it doesn't automatically prevent overlapping address spaces during VNet creation or updates. You can enforce non-overlapping address spaces by combining Azure Policy with IP Address Management (IPAM) pools, ensuring network connectivity without IP conflicts in your environment.
14
+
Azure Virtual Network Manager helps you centrally manage virtual networks across your organization. While it provides governance for VNets, it doesn't automatically prevent overlapping address spaces during virtual network creation or updates. You can enforce nonoverlapping address spaces by combining [Azure Policy](../governance/policy/overview.md) with [IP Address Management (IPAM) pools](concept-ip-address-management.md#manage-ip-address-pools), ensuring network connectivity without IP conflicts in your environment.
15
15
16
-
The following sample Azure policy definition ensures that any virtual network (Microsoft.Network/virtualNetworks) must have at least one IPAM pool prefix allocation from one of the two specified pools. If a virtual network lacks an allocation from either pool, the policy denies the deployment or update of that resource. This enforces VNets with only non-overlapped CIDRs can be created in the scope of this policy definition.
17
-
18
-
so the tutorial shows the policy definition
19
-
20
-
once this policy definition is applied to an Azure policy scope like subscription/management group, then it's enforced on the scope
21
-
16
+
The following sample Azure policy definition ensures that any virtual network (`Microsoft.Network/virtualNetworks`) in the scope of this policy definition must have one IPAM pool prefix allocation from one of the two specified pools. If a virtual network lacks an allocation from either pool, the policy denies the creation or update of a virtual network by enforcing the use of nonoverlapped classless inter-domain routing (CIDRs) addresses.
22
17
23
18
```json
24
19
"mode": "All",
@@ -49,15 +44,15 @@ once this policy definition is applied to an Azure policy scope like subscriptio
@@ -80,17 +75,25 @@ once this policy definition is applied to an Azure policy scope like subscriptio
80
75
}
81
76
```
82
77
83
-
This Azure Policy blocks the creation or update of a virtual network unless it includes an IPAM pool allocation from one of two approved pools. It works as follows:
78
+
Included in the policy definition are the following actions:
84
79
85
-
Resource Check: It applies only to virtual networks (Microsoft.Network/virtualNetworks).
80
+
-**Resource Check** - It applies only to virtual networks (`Microsoft.Network/virtualNetworks`).
81
+
-**Pool Allocation Check** - It verifies if the virtual network has an IPAM pool allocation from either:
82
+
-`IPAM-pool-2`, or
83
+
-`IPAM-pool-3`.
84
+
-**Enforcement** - If neither allocation is present, the policy denies the action. And in order to have pool allocation, IP prefixes must be nonoverlapped within the pool, as such no VNets with overlapped prefixes can be created.
85
+
Resource Check: It applies only to virtual networks (`Microsoft.Network/virtualNetworks`).
86
86
87
-
Pool Allocation Check: It verifies if the virtual network has an IPAM pool allocation from either:
87
+
## Implementation steps of the policy
88
88
89
-
paigePolicyTestPool2, or
89
+
With the policy definition, you can enforce nonoverlapping address spaces in your Azure environment. Follow these steps to implement the policy:
90
90
91
-
paigePolicyTestPool3.
91
+
1.**Identify existing network manager and IPAM pools** - Ensure you have an existing Azure Virtual Network Manager instance and at least two IPAM pools created. For more information, see [Create a virtual network manager](./create-virtual-network-manager-powershell.md) and [Create an IPAM pool](./how-to-manage-ip-addresses-network-manager.md).
92
+
1.**Create an Azure Policy definition** - Create a policy definition in Azure Policy using the JSON example. You can do this through the Azure portal, Azure CLI, or PowerShell. For more information, see [Create and assign a policy definition](../governance/policy/tutorials/create-and-manage.md).
93
+
2.**Assign the policy** - Assign the policy to a specific scope (subscription or management group) where you want to enforce the nonoverlapping address space rule.
94
+
1.**Test the policy** - Create or update a virtual network without an IPAM pool allocation from the specified pools. The operation should be denied if the policy is working correctly.
92
95
93
-
Enforcement: If neither allocation is present, the policy denies the action. And in order to have pool allocation, IP prefixes must be non-overlapped within the pool, as such no VNets with overlapped prefixes can be created.
94
96
95
97
## Next steps
96
-
-[Create a virtual network using Azure CLI](../quickstart-create-vnet-cli.md)
98
+
> [!div class="nextstepaction"]
99
+
> [Manage IP addresses with Azure Virtual Network Manager](./how-to-manage-ip-addresses-network-manager.md)
0 commit comments