Skip to content

Commit 374a4a2

Browse files
CaptainFanZzzZiyue Zhengisra-fel
authored
Fix Az.Resources Syntax Errors (#17769)
* Fix Az.Resources Syntax Errors * Fix Az.Resources Syntax Errors * update subid * Update Get-AzTag.md Co-authored-by: Ziyue Zheng <v-ziyzhe@microsoft.com> Co-authored-by: Yeming Liu <11371776+isra-fel@users.noreply.github.com>
1 parent 7aa9fd5 commit 374a4a2

18 files changed

+47
-42
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This command gets all deployments at the management group "myMG".
4040

4141
### Example 2: Get a deployment by name
4242
```powershell
43-
Get-AzDeployment -ManagementGroupId "myMG" -Name "Deploy01"
43+
Get-AzManagementGroupDeployment -ManagementGroupId "myMG" -Name "Deploy01"
4444
```
4545

4646
This command gets the "Deploy01" deployment at the management group "myMG".

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ This command gets all built-in policy definitions from the subscription with ID
8484

8585
### Example 5: Get policy definitions from a given category
8686
```powershell
87-
Get-AzPolicyDefinition | where-object {$_.Properties.metadata.category -eq "Virtual Machine"}
87+
Get-AzPolicyDefinition | Where-Object {$_.Properties.metadata.category -eq "Virtual Machine"}
8888
```
8989

9090
This command gets all policy definitions in category "Virtual Machine".

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ This command gets all custom policy set definitions from the management group na
8383

8484
### Example 5: Get policy set definitions from a given category
8585
```powershell
86-
Get-AzPolicySetDefinition | where-object {$_.Properties.metadata.category -eq "Virtual Machine"}
86+
Get-AzPolicySetDefinition | Where-Object {$_.Properties.metadata.category -eq "Virtual Machine"}
8787
```
8888

8989
This command gets all policy set definitions in category "Virtual Machine".

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The **Get-AzResource** cmdlet gets Azure resources.
4343
### Example 1: Get all resources in the current subscription
4444

4545
```powershell
46-
Get-AzResource | ft
46+
Get-AzResource | Format-Table
4747
```
4848

4949
```output
@@ -65,7 +65,7 @@ This command gets all of the resources in the current subscription.
6565
### Example 2: Get all resources in a resource group
6666

6767
```powershell
68-
Get-AzResource -ResourceGroupName testRG | ft
68+
Get-AzResource -ResourceGroupName testRG | Format-Table
6969
```
7070

7171
```output
@@ -84,7 +84,7 @@ This command gets all of the resources in the resource group "testRG".
8484
### Example 3: Get all resources whose resource group matches the provided wildcard
8585

8686
```powershell
87-
Get-AzResource -ResourceGroupName other* | ft
87+
Get-AzResource -ResourceGroupName other* | Format-Table
8888
```
8989

9090
```output
@@ -100,7 +100,7 @@ This command gets all of the resources whose resource group they belong in being
100100
### Example 4: Get all resources with a given name
101101

102102
```powershell
103-
Get-AzResource -Name testVM | fl
103+
Get-AzResource -Name testVM | Format-List
104104
```
105105

106106
```output
@@ -122,7 +122,7 @@ This command gets all of the resources whose resource name is "testVM".
122122
### Example 5: Get all resources whose name matches the provided wildcard
123123

124124
```powershell
125-
Get-AzResource -Name test* | ft
125+
Get-AzResource -Name test* | Format-Table
126126
```
127127

128128
```output
@@ -138,7 +138,7 @@ This command gets all of the resources whose resource name begins with "test".
138138
### Example 6: Get all resources of a given resource type
139139

140140
```powershell
141-
Get-AzResource -ResourceType Microsoft.Compute/virtualMachines | ft
141+
Get-AzResource -ResourceType Microsoft.Compute/virtualMachines | Format-Table
142142
```
143143

144144
```output

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ Get-AzResourceGroup -Tag @{'environment'='prod'}
5555
### Example 4: Show the Resource groups by location
5656
```powershell
5757
Get-AzResourceGroup |
58-
Sort Location,ResourceGroupName |
59-
Format-Table -GroupBy Location ResourceGroupName,ProvisioningState,Tags
58+
Sort-Object Location,ResourceGroupName |
59+
Format-Table -GroupBy Location ResourceGroupName,ProvisioningState,Tags
6060
```
6161

6262
### Example 5: Show the names of all the Resource groups in a particular location
6363
```powershell
6464
Get-AzResourceGroup -Location westus2 |
65-
Sort ResourceGroupName |
66-
Format-Wide ResourceGroupName -Column 4
65+
Sort-Object ResourceGroupName |
66+
Format-Wide ResourceGroupName -Column 4
6767
```
6868

6969
### Example 6: Show the Resource groups whose names begin with WebServer

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Using the *Detailed* parameter is the equivalent of using the *Name* parameter f
115115
### Example 4: Get the entire set of tags on a subscription
116116

117117
```powershell
118-
Get-AzTag -ResourceId /subscriptions/{subId}
118+
Get-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
119119
```
120120

121121
```output
@@ -134,7 +134,7 @@ This command gets the entire set of tags on the subscription with {subId}.
134134
### Example 5: Get the entire set of tags on a resource
135135

136136
```powershell
137-
Get-AzTag -ResourceId /subscriptions/{subId}/resourcegroups/{rg}/providers/Microsoft.Sql/servers/Server1
137+
Get-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/testrg/providers/Microsoft.Sql/servers/Server1
138138
```
139139

140140
```output

src/Resources/Resources/help/Invoke-AzResourceAction.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ To get a list of supported actions, use the Azure Resource Explorer tool.
4545
### Example 1: Invoke starting a VM with ResourceId
4646

4747
```powershell
48-
Invoke-AzResourceAction -ResourceId /subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.Compute/virtualMachines/testVM -Action start
48+
Invoke-AzResourceAction -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testVM -Action start
4949
```
5050

5151
```output
5252
Confirm
53-
Are you sure you want to invoke the 'start' action on the following resource: /subscriptions/{subId}/resourceGroups/testGroup/providers/Microsoft.Compute/virtualMachines/testVM
53+
Are you sure you want to invoke the 'start' action on the following resource: /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testVM
5454
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
5555
```
5656

@@ -68,11 +68,11 @@ The command specifies the *Force* parameter, therefore, it does not prompt you f
6868
### Example 3: Invoke registering a resource provider with ResourceId
6969

7070
```powershell
71-
Invoke-AzResourceAction -ResourceId /subscriptions/{subId}/providers/Microsoft.Network -action register -Force
71+
Invoke-AzResourceAction -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Network -action register -Force
7272
```
7373

7474
```output
75-
id : /subscriptions/{subId}/providers/Microsoft.Network
75+
id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Network
7676
namespace : Microsoft.Network
7777
authorizations : {…}
7878
resourceTypes : {@{resourceType=virtualNetworks; locations=System.Object[]; apiVersions=System.Object[]},

src/Resources/Resources/help/New-AzDeployment.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,11 @@ Template parameter values that you enter at the command prompt take precedence o
172172

173173
### Example 1: Use a custom template and parameter file to create a deployment
174174
```powershell
175-
New-AzDeployment -Location "West US" -TemplateFile "D:\Azure\Templates\EngineeringSite.json" -TemplateParameterFile "D:\Azure\Templates\EngSiteParms.json" -TemplateVersion "2.1" -Tag @{"key1"="value1"; "key2"="value2";}
175+
New-AzDeployment -Location "West US" -TemplateFile "D:\Azure\Templates\EngineeringSite.json" -TemplateParameterFile "D:\Azure\Templates\EngSiteParms.json" -Tag @{"key1"="value1"; "key2"="value2";}
176176
```
177177

178178
This command creates a new deployment at the current subscription scope by using a custom template and a template file on disk, with defined tags parameter.
179179
The command uses the *TemplateFile* parameter to specify the template and the *TemplateParameterFile* parameter to specify a file that contains parameters and parameter values.
180-
It uses the *TemplateVersion* parameter to specify the version of the template.
181180

182181
### Example 2: Deploy a template stored in a non public storage account using a uri and SAS token
183182
```powershell
@@ -192,13 +191,12 @@ This can be used if you want to use a template in a storage account by providing
192191
```powershell
193192
$TemplateFileText = [System.IO.File]::ReadAllText("D:\Azure\Templates\EngineeringSite.json")
194193
$TemplateObject = ConvertFrom-Json $TemplateFileText -AsHashtable
195-
New-AzDeployment -Location "West US" -TemplateObject $TemplateObject -TemplateParameterFile "D:\Azure\Templates\EngSiteParams.json" -TemplateVersion "2.1"
194+
New-AzDeployment -Location "West US" -TemplateObject $TemplateObject -TemplateParameterFile "D:\Azure\Templates\EngSiteParams.json"
196195
```
197196

198197
This command creates a new deployment at the current subscription scope by using a custom template and a template file on disk that has been converted to an in-memory hashtable.
199198
The first two commands read the text for the template file on disk and convert it to an in-memory hashtable.
200199
The last command uses the *TemplateObject* parameter to specify this hashtable and the *TemplateParameterFile* parameter to specify a file that contains parameters and parameter values.
201-
It uses the *TemplateVersion* parameter to specify the version of the template.
202200

203201
## PARAMETERS
204202

src/Resources/Resources/help/New-AzPolicyAssignment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ The final command assigns the policy in $Policy at the level of the resource gro
9595
```powershell
9696
$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
9797
$Policy = Get-AzPolicyDefinition -BuiltIn | Where-Object {$_.Properties.DisplayName -eq 'Allowed locations'}
98-
$Locations = Get-AzLocation | where displayname -like '*east*'
98+
$Locations = Get-AzLocation | Where-Object displayname -like '*east*'
9999
$AllowedLocations = @{'listOfAllowedLocations'=($Locations.location)}
100100
New-AzPolicyAssignment -Name 'RestrictLocationPolicyAssignment' -PolicyDefinition $Policy -Scope $ResourceGroup.ResourceId -PolicyParameterObject $AllowedLocations
101101
```

src/Resources/Resources/help/New-AzTag.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,16 @@ If the tag name exists, **New-AzTag** adds the value to the existing tag instead
107107
### Example 4: Use a predefined tag
108108
```powershell
109109
New-AzTag -Name "CostCenter" -Value "0001"
110+
110111
Name: CostCenter
111112
Count: 0
112113
Values:
113114
Name Count
114115
========= =====
115116
0001 0
117+
116118
Set-AzResourceGroup -Name "EngineerBlog" -Tag @{Name="CostCenter";Value="0001"}
119+
117120
Name: EngineerBlog
118121
Location: East US
119122
Resources:
@@ -127,14 +130,18 @@ Tags:
127130
Name Value
128131
========== =====
129132
CostCenter 0001
133+
130134
Get-AzTag -Name "CostCenter"
135+
131136
Name: CostCenter
132137
Count: 1
133138
Values:
134139
Name Count
135140
========= =====
136141
0001 1
142+
137143
Get-AzResourceGroup -Tag @{Name="CostCenter"}
144+
138145
Name: EngineerBlog
139146
Location: East US
140147
Resources:
@@ -156,7 +163,7 @@ The commands in this example create and use a predefined tag.
156163

157164
```powershell
158165
$Tags = @{"tagKey1"="tagValue1"; "tagKey2"="tagValue2"}
159-
New-AzTag -ResourceId /subscriptions/{subId} -Tag $Tags
166+
New-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -Tag $Tags
160167
```
161168

162169
```output
@@ -176,7 +183,7 @@ This command creates or updates the entire set of tags on the subscription with
176183

177184
```powershell
178185
$Tags = @{"Dept"="Finance"; "Status"="Normal"}
179-
New-AzTag -ResourceId /subscriptions/{subId}/resourcegroups/{rg}/providers/Microsoft.Sql/servers/Server1 -Tag $Tags
186+
New-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/testrg/providers/Microsoft.Sql/servers/Server1 -Tag $Tags
180187
```
181188

182189
```output

src/Resources/Resources/help/Remove-AzResourceGroupDeployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The **Remove-AzResourceGroupDeployment** cmdlet removes an Azure resource group
3434
### Example 1: Removes a resource group deployment with ResourceId
3535

3636
```powershell
37-
Remove-AzResourceGroupDeployment -ResourceId /subscriptions/{subId}/resourceGroups/testGroup/providers/Microsoft.Resources/deployments/testDeployment1
37+
Remove-AzResourceGroupDeployment -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/testGroup/providers/Microsoft.Resources/deployments/testDeployment1
3838
```
3939

4040
```output

src/Resources/Resources/help/Remove-AzTag.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ If the value has been applied to any resources or resource groups, the command f
7171
### Example 3: Deletes the entire set of tags on a subscription
7272

7373
```powershell
74-
Remove-AzTag -ResourceId /subscriptions/{subId}
74+
Remove-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
7575
```
7676

7777
This command deletes the entire set of tags on the subscription with {subId}. It will not return the object deleted if not passing in "-PassThru".
7878

7979
### Example 4: Deletes the entire set of tags on a resource
8080

8181
```powershell
82-
Remove-AzTag -ResourceId /subscriptions/{subId}/resourcegroups/{rg}/providers/Microsoft.Sql/servers/Server1 -PassThru
82+
Remove-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/testrg/providers/Microsoft.Sql/servers/Server1 -PassThru
8383
```
8484

8585
```output

src/Resources/Resources/help/Save-AzManagementGroupDeploymentTemplate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This command gets the deployment template from TestDeployment and saves it as a
3838

3939
### Example 2: Get a deployment and save its template
4040
```powershell
41-
Get-AzManagementGroupDeploymentTemplate -ManagementGroupId "myMG" -Name "RolesDeployment" | Save-AzManagementGroupDeploymentTemplate
41+
Get-AzManagementGroupDeployment -ManagementGroupId "myMG" -Name "RolesDeployment" | Save-AzManagementGroupDeploymentTemplate
4242
```
4343

4444
This command gets the deployment "RolesDeployment" at the management group "myMG" and saves its template.

src/Resources/Resources/help/Save-AzTenantDeploymentTemplate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This command gets the deployment template from TestDeployment and saves it as a
3838

3939
### Example 2: Get a deployment and save its template
4040
```powershell
41-
Get-AzTenantDeploymentTemplate -Name "RolesDeployment" | Save-AzTenantDeploymentTemplate
41+
Get-AzTenantDeployment -Name "RolesDeployment" | Save-AzTenantDeploymentTemplate
4242
```
4343

4444
This command gets the deployment "RolesDeployment" at the current tenant scope and saves its template.

src/Resources/Resources/help/Set-AzPolicyAssignment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ The final command assigns the user assigned managed identity identified by the *
120120

121121
### Example 4: Update policy assignment parameters with new policy parameter object
122122
```powershell
123-
$Locations = Get-AzLocation | where {($_.displayname -like 'france*') -or ($_.displayname -like 'uk*')}
123+
$Locations = Get-AzLocation | Where-Object {($_.displayname -like 'france*') -or ($_.displayname -like 'uk*')}
124124
$AllowedLocations = @{'listOfAllowedLocations'=($Locations.location)}
125125
$PolicyAssignment = Get-AzPolicyAssignment -Name 'PolicyAssignment'
126126
Set-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -PolicyParameterObject $AllowedLocations

src/Resources/Resources/help/Set-AzPolicySetDefinition.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ The **Set-AzPolicySetDefinition** cmdlet modifies a policy definition.
6060
### Example 1: Update the description of a policy set definition
6161
```powershell
6262
$PolicySetDefinition = Get-AzPolicySetDefinition -ResourceId '/subscriptions/mySub/Microsoft.Authorization/policySetDefinitions/myPSSetDefinition'
63-
Set-AzPolicySetDefinition -Id $PolicySetDefinition.ResourceId -Description 'Updated policy to not allow virtual machine creation'
63+
Set-AzPolicySetDefinition -Id $PolicySetDefinition.ResourceId -Description 'Updated policy to not allow virtual machine creation'
6464
```
6565

6666
The first command gets a policy set definition by using the Get-AzPolicySetDefinition cmdlet.
@@ -93,7 +93,7 @@ This command updates the groups of a policy set definition named VMPolicySetDefi
9393

9494
### Example 4: Update the groups of a policy set definition using a hash table
9595
```powershell
96-
$groupsJson = ConvertTo-Json @{ name = "group1", displayName = "Virtual Machine Security" }, @{ name = "group2" }
96+
$groupsJson = ConvertTo-Json @{ name = "group1"; displayName = "Virtual Machine Security" }, @{ name = "group2" }
9797
Set-AzPolicySetDefinition -Name 'VMPolicySetDefinition' -GroupDefinition $groupsJson
9898
```
9999

src/Resources/Resources/help/Update-AzManagementGroup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The **Update-AzManagementGroup** cmdlet updates the **ParentId** or **DisplayNam
4444

4545
### Example 1: Update a Management Group's Display Name
4646
```powershell
47-
Update-AzManagementGroup -Group "TestGroup" -DisplayName "New Display Name"
47+
Update-AzManagementGroup -GroupName "TestGroup" -DisplayName "New Display Name"
4848
```
4949

5050
```output
@@ -62,7 +62,7 @@ ParentDisplayName : 6b2064b9-34bd-46e6-9092-52f2dd5f7fc0
6262

6363
### Example 2: Update a Management Group's Parent
6464
```powershell
65-
Update-AzManagementGroup -Group "TestGroup" -ParentId "/providers/Microsoft.Management/managementGroups/TestGroupParent"
65+
Update-AzManagementGroup -GroupName "TestGroup" -ParentId "/providers/Microsoft.Management/managementGroups/TestGroupParent"
6666
```
6767

6868
```output

src/Resources/Resources/help/Update-AzTag.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This operation allows replacing, merging or selectively deleting tags on the spe
3030

3131
```powershell
3232
$mergedTags = @{"key1"="value1"; "key3"="value3";}
33-
Update-AzTag -ResourceId /subscriptions/{subId} -Tag $mergedTags -Operation Merge
33+
Update-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -Tag $mergedTags -Operation Merge
3434
```
3535

3636
```output
@@ -45,13 +45,13 @@ Properties :
4545
key3 value3
4646
```
4747

48-
This command Merges the set of tags on the subscription with {subId}.
48+
This command Merges the set of tags on the subscription with "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".
4949

5050
### Example 2: Selectively updates the set of tags on a subscription with "Replace" Operation
5151

5252
```powershell
5353
$replacedTags = @{"key1"="value1"; "key3"="value3";}
54-
Update-AzTag -ResourceId /subscriptions/{subId} -Tag $replacedTags -Operation Replace
54+
Update-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -Tag $replacedTags -Operation Replace
5555
```
5656

5757
```output
@@ -65,13 +65,13 @@ Properties :
6565
key3 value3
6666
```
6767

68-
This command Replaces the set of tags on the subscription with {subId}.
68+
This command Replaces the set of tags on the subscription with "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".
6969

7070
### Example 3: Selectively updates the set of tags on a subscription with "Delete" Operation
7171

7272
```powershell
7373
$deletedTags = @{"key1"="value1"}
74-
Update-AzTag -ResourceId /subscriptions/{subId} -Tag $deletedTags -Operation Delete
74+
Update-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -Tag $deletedTags -Operation Delete
7575
```
7676

7777
```output
@@ -84,7 +84,7 @@ Properties :
8484
key3 value3
8585
```
8686

87-
This command Deletes the set of tags on the subscription with {subId}.
87+
This command Deletes the set of tags on the subscription with "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".
8888

8989
## PARAMETERS
9090

0 commit comments

Comments
 (0)