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/create-virtual-network-manager-powershell.md
+92-93Lines changed: 92 additions & 93 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,133 +178,132 @@ Once your network group is created, you define a network group's membership by a
178
178
179
179
### Manually add membership
180
180
181
-
In this task, you manually add two virtual networks for your Mesh configuration to your network group using these steps:
182
-
183
-
1. Add the static member to the network group with the following commands:
184
-
1. Static members must have a network group scoped unique name. It's recommended to use a consistent hash of the virtual network ID. This is an approach using the ARM Templates uniqueString() implementation.
185
-
186
-
```azurepowershell-interactive
187
-
function Get-UniqueString ([string]$id, $length=13)
In this task, you add the static members **vnet-learn-prod-eastus-001** and **vnet-learn-prod-eastus-002** to the network group **ng-learn-prod-eastus-001** using [New-AzNetworkManagerStaticMember](/powershell/module/az.network/new-aznetworkmanagerstaticmember).
182
+
183
+
> [!NOTE]
184
+
> Static members must have a network group scoped unique name. It's recommended to use a consistent hash of the virtual network ID. This is an approach using the ARM Templates uniqueString() implementation.
185
+
186
+
```azurepowershell-interactive
187
+
function Get-UniqueString ([string]$id, $length=13)
Using [Azure Policy](concept-azure-policy-integration.md), you define a condition to dynamically add two virtual networks to your network group when the name of the virtual network includes **prod** using these steps:
218
+
### Create a policy for dynamic membership
219
+
220
+
Using [Azure Policy](concept-azure-policy-integration.md), you define a condition to dynamically add two virtual networks to your network group when the name of the virtual network name includes **-prod** using these steps:
231
221
232
222
1. Define the conditional statement and store it in a variable.
233
223
> [!NOTE]
234
-
> It is recommended to scope all of your conditionals to only scan for type `Microsoft.Network/virtualNetwork` for efficiency.
235
-
236
-
```azurepowershell-interactive
237
-
$conditionalMembership = '{
238
-
"allof":[
239
-
{
240
-
"field": "type",
241
-
"equals": "Microsoft.Network/virtualNetwork"
242
-
}
243
-
{
244
-
"field": "name",
245
-
"contains": "VNet"
246
-
}
247
-
]
248
-
}'
249
-
```
224
+
> It is recommended to scope all of your conditionals to only scan for type `Microsoft.Network/virtualNetworks` for efficiency.
1. Create the Azure Policy definition using the conditional statement defined in the last step using New-AzPolicyDefinition.
249
+
1. Create the Azure Policy definition using the conditional statement defined in the last step using [New-AzPolicyDefinition](/powershell/module/az.resources/new-azpolicydefinition). In this example, the policy definition name is prefixed with **poldef-learn-prod-** and suffixed with a unique string generated from a consistent hash the network group ID. Policy resources must have a scope unique name.
252
250
253
-
> [!IMPORTANT]
254
-
> Policy resources must have a scope unique name. It is recommended to use a consistent hash of the network group. This is an approach using the ARM Templates uniqueString() implementation.
255
-
256
-
```azurepowershell-interactive
257
-
function Get-UniqueString ([string]$id, $length=13)
In this task, you create a connectivity configuration with the network group **ng-learn-prod-eastus-001** using [New-AzNetworkManagerConnectivityConfiguration](/powershell/module/az.network/new-aznetworkmanagerconnectivityconfiguration) and [New-AzNetworkManagerConnectivityGroupItem](/powershell/module/az.network/new-aznetworkmanagerconnectivitygroupitem).
284
+
286
285
287
-
1. Create a connectivity group item to add a network group to with New-AzNetworkManagerConnectivityGroupItem.
0 commit comments