Skip to content

Commit c5406c6

Browse files
authored
Typos
1 parent edeff58 commit c5406c6

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

articles/virtual-network-manager/create-virtual-network-manager-powershell.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -212,43 +212,43 @@ $virtualnetworkC | Set-AzVirtualNetwork
212212
> [!NOTE]
213213
> It is recommended to scope all of your conditionals to only scan for type `Microsoft.Network/virtualNetwork` for efficiency.
214214
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+
}'
228228
```
229229
230230
1. Create the Azure Policy definition using the conditional statement defined in the last step using New-AzPolicyDefinition.
231231

232232
> [!IMPORTANT]
233233
> 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.
234234
235-
```azurepowershell-interactive
236-
function Get-UniqueString ([string]$id, $length=13)
237-
{
238-
$hashArray = (new-object System.Security.Cryptography.SHA512Managed).ComputeHash($id.ToCharArray())
239-
-join ($hashArray[1..$length] | ForEach-Object { [char]($_ % 26 + [byte][char]'a') })
240-
}
241-
```
242-
243-
```azurepowershell-interactive
244-
$defn = @{
245-
Name = Get-UniqueString $networkgroup.Id
246-
Mode = 'Microsoft.Network.Data'
247-
Policy = $conditionalMembership
248-
}
249-
250-
$policyDefinition = New-AzPolicyDefinition $defn
251-
```
235+
```azurepowershell-interactive
236+
function Get-UniqueString ([string]$id, $length=13)
237+
{
238+
$hashArray = (new-object System.Security.Cryptography.SHA512Managed).ComputeHash($id.ToCharArray())
239+
-join ($hashArray[1..$length] | ForEach-Object { [char]($_ % 26 + [byte][char]'a') })
240+
}
241+
```
242+
243+
```azurepowershell-interactive
244+
$defn = @{
245+
Name = Get-UniqueString $networkgroup.Id
246+
Mode = 'Microsoft.Network.Data'
247+
Policy = $conditionalMembership
248+
}
249+
250+
$policyDefinition = New-AzPolicyDefinition @defn
251+
```
252252

253253
1. Assign the policy definition at a scope within your network managers scope for it to begin taking effect.
254254

@@ -258,7 +258,7 @@ $policyDefinition = New-AzPolicyDefinition $defn
258258
PolicyDefinition = $policyDefinition
259259
}
260260
261-
$policyAssignment = New-AzPolicyAssignment $assgn
261+
$policyAssignment = New-AzPolicyAssignment @assgn
262262
```
263263
264264
## Create a configuration

0 commit comments

Comments
 (0)