Skip to content

Commit

Permalink
Add new examples (Azure#20361)
Browse files Browse the repository at this point in the history
* Add new examples

* Implement Mike's feedback
  • Loading branch information
timwarner-msft authored Dec 7, 2022
1 parent 123683c commit d126c2e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/Resources/Resources/help/Get-AzPolicyAssignment.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ Get-AzPolicyAssignment -Scope '/providers/Microsoft.Management/managementgroups/
The first command specifies the ID of the management group to query.
The second command gets all of the policy assignments that are assigned to the management group with ID 'myManagementGroup'.

### Example 4: Get the scope, policy set definition identifier, and display name of all policy assignments formatted as a list

```powershell
Get-AzPolicyAssignment | Select-Object -ExpandProperty properties | Select-Object -Property Scope, PolicyDefinitionID, DisplayName | Format-List
```

This command is useful when you need to find the reader-friendly **DisplayName** property of an Azure
Policy assignment.

## PARAMETERS

### -ApiVersion
Expand Down
13 changes: 11 additions & 2 deletions src/Resources/Resources/help/Get-AzPolicyDefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,19 @@ This command gets all built-in policy definitions from the subscription with ID

### Example 5: Get policy definitions from a given category
```powershell
Get-AzPolicyDefinition | Where-Object {$_.Properties.metadata.category -eq "Virtual Machine"}
Get-AzPolicyDefinition | Where-Object {$_.Properties.metadata.category -eq 'Tags'}
```

This command gets all policy definitions in category "Virtual Machine".
This command gets all policy definitions in the category **Tags**.

### Example 6: Get the display name, description, policy type, and metadata of all policy definitions formatted as a list

```powershell
Get-AzPolicyDefinition | Select-Object -ExpandProperty properties | Select-Object -Property DisplayName, Description, PolicyType, Metadata | Format-List
```

This command is useful when you need to find the reader-friendly **DisplayName** property of an Azure
Policy definition. You can parse the **Metadata** property to discover the policy definition's version number and category assignment.

## PARAMETERS

Expand Down

0 comments on commit d126c2e

Please sign in to comment.