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
> It is recommended to scope all of your conditionals to only scan for type `Microsoft.Network/virtualNetwork` for efficiency.
214
214
215
-
```azurepowershell-interactive
216
-
$conditionalMembership = '{
217
-
"allof":[
218
-
{
219
-
"field": "type",
220
-
"equals": "Microsoft.Network/virtualNetwork"
221
-
}
222
-
{
223
-
"field": "name",
224
-
"contains": "VNet"
225
-
}
226
-
]
227
-
}'
215
+
```azurepowershell-interactive
216
+
$conditionalMembership = '{
217
+
"allof":[
218
+
{
219
+
"field": "type",
220
+
"equals": "Microsoft.Network/virtualNetwork"
221
+
}
222
+
{
223
+
"field": "name",
224
+
"contains": "VNet"
225
+
}
226
+
]
227
+
}'
228
228
```
229
229
230
230
1. Create the Azure Policy definition using the conditional statement defined in the last step using New-AzPolicyDefinition.
231
231
232
232
> [!IMPORTANT]
233
233
> Policy resources must have a scope unique name. It is recommended to use a consistent hash of the network group. Below is an approach using the ARM Templates uniqueString() implementation.
234
234
235
-
```azurepowershell-interactive
236
-
function Get-UniqueString ([string]$id, $length=13)
0 commit comments