Skip to content

Commit 6f04e7e

Browse files
Merge pull request #293634 from MSFT-Monish/MSFT-Monish-dupObject
updating powershell method to copy policy definition in MC scenario
2 parents ebbc7ce + 5be5903 commit 6f04e7e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

articles/governance/policy/troubleshoot/general.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,12 @@ Guest configuration relies on custom metadata added to policy definitions when c
333333
#### Resolution
334334

335335
Instead of using the portal, duplicate the policy definition using the Policy
336-
Insights API. The following PowerShell sample provides an option.
336+
Insights API. The following PowerShell sample can copy the policy definition including the metadata using **Az.Resources 7.3.0** or higher.
337337

338338
```powershell
339339
# duplicates the built-in policy which audits Windows machines for pending reboots
340-
$def = Get-AzPolicyDefinition -id '/providers/Microsoft.Authorization/policyDefinitions/4221adbc-5c0f-474f-88b7-037a99e6114c' | % Properties
341-
New-AzPolicyDefinition -name (new-guid).guid -DisplayName "$($def.DisplayName) (Copy)" -Description $def.Description -Metadata ($def.Metadata | convertto-json) -Parameter ($def.Parameters | convertto-json) -Policy ($def.PolicyRule | convertto-json -depth 15)
340+
$def = Get-AzPolicyDefinition -id "/providers/Microsoft.Authorization/policyDefinitions/4221adbc-5c0f-474f-88b7-037a99e6114c"
341+
New-AzPolicyDefinition -name (new-guid).guid -DisplayName "$($def.DisplayName) (Copy)" -Description $def.Description -Metadata ($def.Metadata | convertto-json) -Parameter ($def.Parameter | convertto-json) -Policy ($def.PolicyRule | convertto-json -depth 15)
342342
```
343343

344344
### Scenario: Kubernetes resource gets created during connectivity failure despite deny policy being assigned

0 commit comments

Comments
 (0)