Skip to content

Commit 19de83f

Browse files
committed
clarified CLI Steps and added images for portal process
1 parent 19691a2 commit 19de83f

File tree

3 files changed

+48
-53
lines changed

3 files changed

+48
-53
lines changed

articles/virtual-network-manager/deploy-cross-tenant-ip-address-management.md

Lines changed: 48 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -12,58 +12,36 @@ ms.date: 05/05/2025
1212

1313
In this article, you learn how to deploy a virtual network in a managed tenant (Tenant B) that draws from an Azure Virtual Network Manager (AVNM) IP Address Management (IPAM) pool maintained in a management tenant (Tenant A). This process demonstrates how a parent organization can centrally manage IP address allocations across multiple child organizations that exist in different Azure tenants.
1414

15+
In this cross-tenant deployment, the management tenant (Tenant A) is the parent organization that manages IP address allocations for multiple child organizations (managed tenants) from a central network manager. The managed tenant (Tenant B) is a child organization that consumes IP address allocations from the management tenant. The managed tenant hosts the virtual networks that consume IP addresses from Tenant A's IPAM pools.
16+
1517
## Prerequisites
1618

19+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
20+
- - The [latest Azure CLI](/cli/azure/install-azure-cli) version installed.
1721
- Two Azure tenants: a management tenant (Tenant A) and a managed tenant (Tenant B)
1822
- Management tenant (Tenant A) must have:
1923
- An Azure Virtual Network Manager instance If you don't have a network manager instance, see [Create a network manager instance](create-virtual-network-manager-portal.md).
20-
- An IPAM pool created in the network manager instance. If you don't have an IPAM pool, see [Create an IPAM pool](how-to-manage-ip-addresses-network-manager.md#create-an-ip-address-pool).
24+
- An IPAM pool created in the network manager instance. If you don't have an IPAM pool, see [Create an IPAM pool](how-to-manage-ip-addresses-network-manager.md#create-an-ip-address-pool).
2125
- Network manager configured with cross-tenant connection to Tenant B. For more information, see [Add remote tenant scope in Azure Virtual Network Manager](how-to-configure-cross-tenant-portal.md).
2226
- *IPAM Pool User* role assigned to your user or service principal
2327
- Managed tenant (Tenant B) must have:
2428
- *Network Contributor* role assigned at the subscription or virtual network level
25-
- Access to create or modify service principals (for programmatic approach)
26-
27-
## Understanding cross-tenant IPAM architecture
28-
29-
Cross-tenant IPAM deployment has two primary approaches:
30-
31-
- **Azure Portal flow**: Interactive process for manually associating resources
32-
- **Programmatic flow**: Using CLI/REST for automation and integration
33-
34-
### Management tenant (Tenant A)
35-
36-
In this example, the management tenant (Tenant A) is the parent organization that manages IP address allocations for multiple child organizations (managed tenants). The management tenant:
37-
38-
- Hosts the Azure Virtual Network Manager instance
39-
- Contains the authoritative IPAM pools
40-
- Grants permissions to managed tenant entities
41-
42-
### Managed tenant (Tenant B)
43-
44-
In this example, the managed tenant (Tenant B) is a child organization that consumes IP address allocations from the management tenant. The managed tenant:
45-
46-
- Hosts the virtual networks that consume IP addresses from Tenant A's IPAM pools
47-
- Contains service principals for programmatic management
29+
- A service principal with the *Network Contributor* role assigned at the subscription or resource level for using the Azure CLI or REST API. To create and manage a service principal, see [Create an Azure service principal with Azure CLI](/cli/azure/azure-cli-sp-tutorial-1?tabs=bash).
30+
- Access to create or modify service principals (for programmatic approach)
4831

4932
## Deploy cross-tenant IPAM
5033

51-
In thi
34+
In this section, you learn how to deploy a virtual network in Tenant B that uses an IP address allocation from an IPAM pool in Tenant A. The deployment can be done using either the Azure portal or Azure CLI.
5235

5336
# [Azure portal](#tab/azureportal)
5437

5538
### Create an IPAM allocation in the management tenant
5639

5740
1. Sign in to the [Azure portal](https://portal.azure.com/) using credentials with access to Tenant A.
58-
5941
1. Navigate to **Azure Virtual Network Manager** and locate your network manager instance.
60-
6142
1. Select **IP address pools** under **IP address management**.
62-
6343
1. Select the IPAM pool where you want to create an allocation.
64-
6544
1. Select **+ Create**>**Allocate resources**.
66-
6745
1. In the **Allocate resources** pane, select the **Tenant :** dropdown and choose choose the managed tenant (Tenant B) where you want to allocate IP addresses.
6846
1. Select **Apply** and then select **Authenticate**.
6947

@@ -77,42 +55,59 @@ In thi
7755
1. In Tenant A's portal view, navigate to your IP address pool and select **Allocations** under **Settings**.
7856
1. Select **Resources** and verify that the virtual network from Tenant B is listed as an allocated resource.
7957
1. Switch to Tenant B's portal view and navigate to the virtual network that received the allocation.
80-
1. Select **Subnets** under **Settings** and verify the name listed in the **IPAM pool** column matches the name of the IPAM pool in the management tenant (Tenant A).
58+
1. Select **Subnets** under **Settings** and verify the name listed under **IPAM pool** matches the name of the IPAM pool in the management tenant (Tenant A).
59+
60+
:::image type="content" source="media/tutorial-create-secured-hub-and-spoke/managed-tenant-virtual-network-subnets-settings-thumb.png" alt-text="Screenshot of subnet on managed tenant showing IPAM Pool management." lightbox="media/tutorial-create-secured-hub-and-spoke/managed-tenant-virtual-network-subnets-settings.png":::
8161

8262
# [Azure CLI](#tab/azurecli)
8363

64+
In this section, you learn how to deploy a virtual network in Tenant B that uses an IP address allocation from an IPAM pool in Tenant A using the Azure CLI. Before running the commands, you'll need to replace the placeholders in the commands with your own values.
65+
66+
- `<managedTenantID>`: The tenant ID of the managed tenant (Tenant B).
67+
- `<managementTenantID>`: The tenant ID of the management tenant (Tenant A).
68+
- `<servicePrincipalAppID>`: The application ID of the service principal used for authentication.
69+
- `<servicePrincipalPassword>`: The password for the service principal.
70+
- `<managedTenantSubscriptionID>`: The subscription ID of the managed tenant (Tenant B).
71+
- `<managedTenantResourceGroupName>`: The name of the resource group in the managed tenant (Tenant B) where the virtual network will be created.
72+
- `<managedTenantVirtualNetworkName>`: The name of the virtual network to be created in the managed tenant (Tenant B).
73+
- `<managementTenantSubscriptionID>`: The subscription ID of the management tenant (Tenant A).
74+
- `<managementTenantResourceGroupName>`: The name of the resource group in the management tenant (Tenant A) where the IPAM pool is located.
75+
- `<networkManagerName>`: The name of the Azure Virtual Network Manager instance in the management tenant (Tenant A).
76+
- `<ipamPoolName>`: The name of the IPAM pool in the management tenant (Tenant A) that will be used for the allocation.
77+
78+
> [!NOTE]
79+
> In order to use the Azure CLI for cross-tenant IPAM, you need to have a service principal with the *Network Contributor* role assigned at the subscription or resource level in Tenant B. You also need to have access to create or modify service principals in both tenants. To create and manage a service principal, see [Create an Azure service principal with Azure CLI](/cli/azure/azure-cli-sp-tutorial-1?tabs=bash).
80+
8481
### Configure the multi-tenant service principal
8582

8683
1. Sign in to Tenant B using Azure CLI:
8784

8885
```azurecli
89-
az login --tenant <TENANTB_ID>
86+
az login --tenant <managedTenantID>"
9087
```
9188
9289
2. Update your service principal to be multi-tenant:
9390
9491
```azurecli
95-
az ad app update --id "your-app-id" --set signInAudience=AzureADMultipleOrgs
92+
az ad app update --id "<servicePrincipalAppID>" --set signInAudience=AzureADMultipleOrgs
9693
```
9794

9895
3. Sign in to Tenant A:
9996

10097
```azurecli
101-
az login --tenant <TENANTA_ID>
98+
az login --tenant <managementTenantID>
10299
```
103100

104101
4. Create a stub service principal in Tenant A using the same application ID:
105102

106103
```azurecli
107-
az ad sp create --id "your-app-id"
104+
az ad sp create --id "<servicePrincipalAppID>"
108105
```
109106

110107
5. Assign the IPAM Pool User role to the service principal in Tenant A:
111108

112109
```azurecli
113-
az role assignment create --assignee "your-app-id" \
114-
--role "IPAM Pool User" \
115-
--scope "/subscriptions/<MANAGEMENT_SUBSCRIPTION_ID>/resourceGroups/<MANAGEMENT_RG>/providers/Microsoft.Network/networkManagers/<NETWORK_MANAGER_NAME>/ipamPools/<POOL_NAME>"
110+
116111
```
117112

118113
### Deploy a virtual network with cross-tenant IPAM references
@@ -121,26 +116,26 @@ In thi
121116

122117
```azurecli
123118
# Authenticate to Tenant B (deployment tenant)
124-
az login --service-principal --username "your-app-id" --password "CLIENT_SECRET" --tenant "<TENANTB_ID>"
119+
az login --service-principal --username "<servicePrincipalAppID>" --password "<servicePrincipalPassword>" --tenant "<managedTenantID>"
125120
126121
# Authenticate to Tenant A (management tenant)
127-
az login --service-principal --username "your-app-id" --password "CLIENT_SECRET" --tenant "<TENANTA_ID>"
122+
az login --service-principal --username "<servicePrincipalAppID>" --password "<servicePrincipalPassword>" --tenant "<managementTenantID>"
128123
```
129124

130125
2. Obtain an access token from Tenant A:
131126

132127
```azurecli
133128
auxiliaryToken=$(az account get-access-token \
134129
--resource=https://management.azure.com/ \
135-
--tenant "<TENANTA_ID>" \
130+
--tenant "<managementTenantID>" \
136131
--query accessToken -o tsv)
137132
```
138133

139134
3. Deploy the virtual network via the ARM REST API:
140135

141136
```azurecli
142137
az rest --method put \
143-
--uri "https://management.azure.com/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Network/virtualNetworks/<VNET_NAME>?api-version=2022-07-01" \
138+
--uri "https://management.azure.com/subscriptions/<managedTenantSubscriptionID>/resourceGroups/<managedTenantResourceGroupName>/providers/Microsoft.Network/virtualNetworks/<managedTenantVirtualNetworkName>?api-version=2022-07-01" \
144139
--headers "x-ms-authorization-auxiliary=Bearer ${auxiliaryToken}" \
145140
--body '{
146141
"location": "centralus",
@@ -150,7 +145,7 @@ In thi
150145
{
151146
"numberOfIpAddresses": "100",
152147
"pool": {
153-
"id": "/subscriptions/<MANAGEMENT_SUBSCRIPTION_ID>/resourceGroups/<MANAGEMENT_RG>/providers/Microsoft.Network/networkManagers/<NETWORK_MANAGER_NAME>/ipamPools/<POOL_NAME>"
148+
"id": "/subscriptions/<managementTenantSubscriptionID>/resourceGroups/<managementTenantResourceGroupName>/providers/Microsoft.Network/networkManagers/<networkManagerName>/ipamPools/<ipamPoolName>"
154149
}
155150
}
156151
]
@@ -165,19 +160,19 @@ In thi
165160

166161
```azurecli
167162
az network vnet show \
168-
--resource-group <RESOURCE_GROUP> \
169-
--name <VNET_NAME> \
163+
--resource-group <managedTenantResourceGroupName> \
164+
--name <managedTenantVirtualNetworkName> \
170165
--query "addressSpace.addressPrefixes"
171166
```
172167

173168
2. Check the IPAM allocation in Tenant A:
174169

175170
```azurecli
176-
az login --tenant <TENANTA_ID>
171+
az login --tenant <managementTenantID>
177172
az network manager ipam pool prefix list \
178-
--resource-group <MANAGEMENT_RG> \
179-
--network-manager-name <NETWORK_MANAGER_NAME> \
180-
--ipam-pool-name <POOL_NAME>
173+
--resource-group <managementTenantResourceGroupName> \
174+
--network-manager-name <networkManagerInstance> \
175+
--ipam-pool-name <ipamPoolName>
181176
```
182177

183178
---
@@ -208,21 +203,21 @@ To remove an IPAM allocation using Azure CLI:
208203

209204
```azurecli
210205
# Get auxiliary token from Tenant A
211-
az login --tenant <TENANTA_ID>
206+
az login --tenant <managementTenantID>
212207
auxiliaryToken=$(az account get-access-token \
213208
--resource=https://management.azure.com/ \
214-
--tenant "<TENANTA_ID>" \
209+
--tenant "<managementTenantID>" \
215210
--query accessToken -o tsv)
216211
217212
# Login to Tenant B for resource management
218-
az login --tenant <TENANTB_ID>
213+
az login --tenant <managedTenantID>"
219214
```
220215

221216
2. Update the virtual network to remove the IPAM allocation:
222217

223218
```azurecli
224219
az rest --method put \
225-
--uri "https://management.azure.com/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Network/virtualNetworks/<VNET_NAME>?api-version=2022-07-01" \
220+
--uri "https://management.azure.com/managedSubscriptionID/resourceGroups/<resourceGroupName>/providers/Microsoft.Network/virtualNetworks/<virtualNetworkName>?api-version=2022-07-01" \
226221
--headers "x-ms-authorization-auxiliary=Bearer ${auxiliaryToken}" \
227222
--body '{
228223
"location": "centralus",
Loading
Loading

0 commit comments

Comments
 (0)