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
@@ -31,66 +31,94 @@ In this quickstart, you'll deploy three virtual networks and use Azure Virtual N
31
31
32
32
To begin your configuration, sign in to your Azure account. If you use the Cloud Shell "Try It", you're signed in automatically. Use the following examples to help you connect:
33
33
34
-
```azurecli-interactive
34
+
```azurecli
35
35
az login
36
36
```
37
37
38
38
Select the subscription where network manager will be deployed.
39
39
40
-
```azurecli-interactive
40
+
```azurecli
41
41
az account set \
42
-
--subscription "<subscription ID>"
42
+
--subscription "<subscription_id>"
43
43
```
44
+
Update the Azure Virtual Network Manager extension for Azure CLI.
44
45
46
+
```azurecli
47
+
az extension update --name virtual-network-manager
48
+
```
45
49
## Create a resource group
46
50
47
-
Before you can deploy Azure Virtual Network Manager, you have to create a resource group to host the . Create a rnetwork manager esource group with [az group create](/cli/azure/group#az-group-create). This example creates a resource group named **myAVNMResourceGroup** in the **westus** location:
51
+
Before you can deploy Azure Virtual Network Manager, you have to create a resource group to host a network manager with [az group create](/cli/azure/group#az-group-create). This example creates a resource group named **myAVNMResourceGroup** in the **westus** location:
48
52
49
-
```azurecli-interactive
53
+
```azurecli
50
54
az group create \
51
55
--name "myAVNMResourceGroup" \
52
56
--location "westus"
53
57
```
54
58
55
59
## Create a Virtual Network Manager
56
60
57
-
Define the scope and access type this Network Manager instance will have. Create the scope by using [az network manager create](/cli/azure/network/manager#az-network-manager-create). Replace the value *{mgName}* with management group name or *{subscriptionId}* with subscriptions you want Virtual Network Manager to manage virtual networks for.
61
+
Define the scope and access type this Network Manager instance will have. Create the scope by using [az network manager create](/cli/azure/network/manager#az-network-manager-create). Replace the value *<subscription_id>* with the subscription you want Virtual Network Manager to manage virtual networks for. For management groups, replace *<mgName\>* with the management group to manage.
Virtual Network Manager applies configurations to groups of VNets by placing them in **Network Groups.** Create a network group with [az network manager group create](/cli/azure/network/manager/group#az-network-manager-group-create).
74
+
75
+
```azurecli
76
+
az network manager group create \
77
+
--name "myNetworkGroup" \
78
+
--network-manager-name "myAVNM" \
79
+
--resource-group "myAVNMResourceGroup" \
80
+
--description "Network Group for Production virtual networks"
81
+
```
82
+
## Create virtual networks
69
83
70
-
Create three virtual networks with [az network vnet create](/cli/azure/network/vnet#az-network-vnet-create). This example creates virtual networks named **VNetA**, **VNetB** and **VNetC** in the **westus** location. If you already have virtual networks you want create a mesh network with, you can skip to the next section.
84
+
Create five virtual networks with [az network vnet create](/cli/azure/network/vnet#az-network-vnet-create). This example creates virtual networks named **VNetA**, **VNetB**,**VNetC** and **VNetD** in the **West US** location. Each virtual network will have a tag of **networkType** used for dynamic membership. If you already have virtual networks you want create a mesh network with, you can skip to the next section.
71
85
72
-
```azurecli-interactive
86
+
```azurecli
73
87
az network vnet create \
74
88
--name "VNetA" \
75
89
--resource-group "myAVNMResourceGroup" \
76
-
--address-prefix "10.0.0.0/16"
90
+
--address-prefix "10.0.0.0/16" \
91
+
--tags "NetworkType=Prod"
77
92
78
93
az network vnet create \
79
94
--name "VNetB" \
80
95
--resource-group "myAVNMResourceGroup" \
81
-
--address-prefix "10.1.0.0/16"
96
+
--address-prefix "10.1.0.0/16" \
97
+
--tags "NetworkType=Prod"
82
98
83
99
az network vnet create \
84
100
--name "VNetC" \
85
101
--resource-group "myAVNMResourceGroup" \
86
-
--address-prefix "10.2.0.0/16"
87
-
```
102
+
--address-prefix "10.2.0.0/16" \
103
+
--tags "NetworkType=Prod"
104
+
105
+
az network vnet create \
106
+
--name "VNetD" \
107
+
--resource-group "myAVNMResourceGroup" \
108
+
--address-prefix "10.3.0.0/16" \
109
+
--tags "NetworkType=Test"
88
110
111
+
az network vnet create \
112
+
--name "VNetE" \
113
+
--resource-group "myAVNMResourceGroup" \
114
+
--address-prefix "10.4.0.0/16" \
115
+
--tags "NetworkType=Test"
116
+
```
89
117
### Add a subnet to each virtual network
90
118
91
119
To complete the configuration of the virtual networks add a /24 subnet to each one. Create a subnet configuration named **default** with [az network vnet subnet create](/cli/azure/network/vnet/subnet#az-network-vnet-subnet-create):
92
120
93
-
```azurecli-interactive
121
+
```azurecli
94
122
az network vnet subnet create \
95
123
--name "default" \
96
124
--resource-group "myAVNMResourceGroup" \
@@ -108,50 +136,177 @@ az network vnet subnet create \
108
136
--resource-group "myAVNMResourceGroup" \
109
137
--vnet-name "VNetC" \
110
138
--address-prefix "10.2.0.0/24"
139
+
140
+
az network vnet subnet create \
141
+
--name "default" \
142
+
--resource-group "myAVNMResourceGroup" \
143
+
--vnet-name "VNetD" \
144
+
--address-prefix "10.3.0.0/24"
145
+
146
+
az network vnet subnet create \
147
+
--name "default" \
148
+
--resource-group "myAVNMResourceGroup" \
149
+
--vnet-name "VNetE" \
150
+
--address-prefix "10.4.0.0/24"
111
151
```
152
+
## Define membership for a mesh configuration
112
153
113
-
## Create a network group
154
+
Azure Virtual Network manager allows you two methods for adding membership to a network group. Static membership involves manually adding virtual networks, and dynamic membership involves using Azure Policy to dynamically add virtual networks based on conditions. Choose the option you wish to complete for your mesh configuration membership:
114
155
115
-
Create a network group using static membership with [az network manager group create](/cli/azure/network/manager/group#az-network-manager-group-create). Replace the value *{subscriptionId}* with the subscription the virtual network is in.
Using **static membership**, you'll manually add 3 VNets for your Mesh configuration to your Network Group with [az network manager group static-member create](/cli/azure/network/manager/group/static-member#az-network-manager-group-static-member-create). Replace <subscription_id> with the subscription these VNets were created under.
Using [Azure Policy](concept-azure-policy-integration.md), you'll dynamically add the three VNets with a tag **networkType** value of *Prod* to the Network Group. These are the three virtual networks to become part of the mesh configuration.
189
+
190
+
> [!NOTE]
191
+
> Policies can be applied to a subscription or management group, and must always be defined *at or above* the level they're created. Only virtual networks within a policy scope are added to a Network Group.
192
+
193
+
### Create a Policy definition
194
+
Create a Policy definition with [az policy definition create](/cli/azure/policy/definition#az-policy-definition-create) for virtual networks tagged as **Prod**. Replace *<subscription_id>* with the subscription you want to apply this policy to. If you want to apply it to a management group, replace `--subscription <subscription_id>` with `--management-group <mgName>`
Once a policy is defined, it must also be applied with [az policy assignment create](/cli/azure/policy/assignment#az-policy-assignment-create). Replace *<subscription_id>* with the subscription you want to apply this policy to. If you want to apply it to a management group, replace `--scope "/subscriptions/<subscription_id>"` with `--scope "/providers/Microsoft.Management/managementGroups/<mgName>`, and replace *<mgName\>* with your management group.
208
+
209
+
```azurecli
210
+
211
+
212
+
az policy assignment create \
213
+
--name "ProdVNets" \
214
+
--description "Take only virtual networks tagged NetworkType:Prod" \
Create a mesh network topology configuration with [az network manager connect-config create](/cli/azure/network/manager/connect-config#az-network-manager-connect-config-create):
221
+
Now that the Network Group is created, and has the correct VNets, create a mesh network topology configuration with [az network manager connect-config create](/cli/azure/network/manager/connect-config#az-network-manager-connect-config-create). Replace <subscription_id> with your subscription.
Commit a connectivity configuration with [az network manager post-commit](/cli/azure/network/manager#az-network-manager-post-commit):
234
+
For the configuration to take effect, commit the configuration to the target regions with [az network manager post-commit](/cli/azure/network/manager#az-network-manager-post-commit):
Virtual Networks will display configurations applied to them with [az network manager list-effective-connectivity-config](/cli/azure/network/manager#az-network-manager-list-effective-connectivity-config):
247
+
248
+
```azurecli
249
+
az network manager list-effective-connectivity-config \
250
+
--resource-group "myAVNMResourceGroup" \
251
+
--virtual-network-name "VNetA"
252
+
253
+
az network manager list-effective-connectivity-config \
254
+
--resource-group "myAVNMResourceGroup" \
255
+
--virtual-network-name "VNetB"
154
256
257
+
258
+
az network manager list-effective-connectivity-config \
259
+
--resource-group "myAVNMResourceGroup" \
260
+
--virtual-network-name "VNetC"
261
+
262
+
az network manager list-effective-connectivity-config \
263
+
--resource-group "myAVNMResourceGroup" \
264
+
--virtual-network-name "VNetD"
265
+
```
266
+
For the virtual networks that are part of the connectivity configuration, you'll see an output similar to this:
For virtual networks not part of the network group like **VNetD**, you'll see an output similar to this:
302
+
303
+
```json
304
+
az network manager list-effective-connectivity-config --resource-group "myAVNMResourceGroup" --virtual-network-name "VNetD-test"
305
+
{
306
+
"skipToken": "",
307
+
"value": []
308
+
}
309
+
```
155
310
## Clean up resources
156
311
157
312
If you no longer need the Azure Virtual Network Manager, you'll need to make sure all of following are true before you can delete the resource:
@@ -162,7 +317,7 @@ If you no longer need the Azure Virtual Network Manager, you'll need to make sur
162
317
163
318
1. Remove the connectivity deployment by committing no configurations with [az network manager post-commit](/cli/azure/network/manager#az-network-manager-post-commit):
164
319
165
-
```azurecli-interactive
320
+
```azurecli
166
321
az network manager post-commit \
167
322
--network-manager-name "myAVNM" \
168
323
--commit-type "Connectivity" \
@@ -172,7 +327,7 @@ If you no longer need the Azure Virtual Network Manager, you'll need to make sur
172
327
173
328
1. Remove the connectivity configuration with [az network manager connect-config delete](/cli/azure/network/manager/connect-config#az-network-manager-connect-config-delete):
174
329
175
-
```azurecli-interactive
330
+
```azurecli
176
331
az network manager connect-config delete \
177
332
--configuration-name "connectivityconfig" \
178
333
--name "myAVNM" \
@@ -181,7 +336,7 @@ If you no longer need the Azure Virtual Network Manager, you'll need to make sur
181
336
182
337
1. Remove the network group with [az network manager group delete](/cli/azure/network/manager/group#az-network-manager-group-delete):
183
338
184
-
```azurecli-interactive
339
+
```azurecli
185
340
az network manager group delete \
186
341
--name "myNetworkGroup" \
187
342
--network-manager-name "myAVNM" \
@@ -190,15 +345,15 @@ If you no longer need the Azure Virtual Network Manager, you'll need to make sur
190
345
191
346
1. Delete the network manager instance with [az network manager delete](/cli/azure/network/manager#az-network-manager-delete):
192
347
193
-
```azurecli-interactive
348
+
```azurecli
194
349
az network manager delete \
195
350
--name "myAVNM" \
196
351
--resource-group "myAVNMResourceGroup"
197
352
```
198
353
199
354
1. If you no longer need the resource created, delete the resource group with [az group delete](/cli/azure/group#az-group-delete):
200
355
201
-
```azurecli-interactive
356
+
```azurecli
202
357
az group delete \
203
358
--name "myAVNMResourceGroup"
204
359
```
@@ -208,4 +363,5 @@ If you no longer need the Azure Virtual Network Manager, you'll need to make sur
208
363
After you've created the Azure Virtual Network Manager, continue on to learn how to block network traffic by using the security admin configuration:
209
364
210
365
> [!div class="nextstepaction"]
211
-
> [Block network traffic with security admin rules](how-to-block-network-traffic-portal.md)
366
+
[Block network traffic with security admin rules](how-to-block-network-traffic-portal.md)
367
+
[Create a secured hub and spoke network](tutorial-create-secured-hub-and-spoke.md)
0 commit comments