Skip to content

Commit 6712ed2

Browse files
Get-AzResourceGroup - New example, and cleanup (#12828)
Added example on how to get resource groups based on tags, and removed duplicated examples. The two last examples has the same end result, but one piped the result into Where-Object which is not great based on basic PowerShell etiquette (Keep filtering to the left).
1 parent 58eb5d5 commit 6712ed2

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/Resources/Resources/help/Get-AzResourceGroup.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,44 +35,42 @@ For more information about Azure resources and Azure resource groups, see the Ne
3535

3636
### Example 1: Get a resource group by name
3737
```
38-
PS C:\>Get-AzResourceGroup -Name "EngineerBlog"
38+
PS C:\> Get-AzResourceGroup -Name "EngineerBlog"
3939
```
4040

4141
This command gets the Azure resource group in your subscription named EngineerBlog.
4242

4343
### Example 2: Get all tags of a resource group
4444
```
45-
PS C:\>(Get-AzResourceGroup -Name "ContosoRG").Tags
45+
PS C:\> (Get-AzResourceGroup -Name "ContosoRG").Tags
4646
```
4747

4848
This command gets the resource group named ContosoRG, and displays the tags associated with that group.
4949

50-
### Example 3: Show the Resource groups by location
50+
### Example 3: Get resource groups based on tag
51+
```
52+
PS C:\> Get-AzResourceGroup -Tag @{'environment'='prod'}
53+
```
54+
55+
### Example 4: Show the Resource groups by location
5156
```
5257
PS C:\> Get-AzResourceGroup |
5358
Sort Location,ResourceGroupName |
5459
Format-Table -GroupBy Location ResourceGroupName,ProvisioningState,Tags
5560
```
5661

57-
### Example 4: Show the names of all the Resource groups in a particular location
62+
### Example 5: Show the names of all the Resource groups in a particular location
5863
```
5964
PS C:\> Get-AzResourceGroup -Location westus2 |
6065
Sort ResourceGroupName |
6166
Format-Wide ResourceGroupName -Column 4
6267
```
6368

64-
### Example 5: Show the Resource groups whose names begin with WebServer
69+
### Example 6: Show the Resource groups whose names begin with WebServer
6570
```
66-
PS C:\> Get-AzResourceGroup | Where ResourceGroupName -like WebServer*
71+
PS C:\> Get-AzResourceGroup -Name WebServer*
6772
```
6873

69-
### Example 6: Get a resource group by name
70-
```
71-
PS C:\> Get-AzResourceGroup -Name "EngineerBlog*"
72-
```
73-
74-
This command gets the Azure resource group in your subscription that start with "EngineerBlog".
75-
7674
## PARAMETERS
7775

7876
### -ApiVersion

0 commit comments

Comments
 (0)