Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Az.Resources Syntax Errors #17769

Merged
merged 5 commits into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ This command gets all deployments at the management group "myMG".

### Example 2: Get a deployment by name
```powershell
Get-AzDeployment -ManagementGroupId "myMG" -Name "Deploy01"
Get-AzManagementGroupDeployment -ManagementGroupId "myMG" -Name "Deploy01"
```

This command gets the "Deploy01" deployment at the management group "myMG".
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/Resources/help/Get-AzPolicyDefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ 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 "Virtual Machine"}
```

This command gets all policy definitions in category "Virtual Machine".
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/Resources/help/Get-AzPolicySetDefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ This command gets all custom policy set definitions from the management group na

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

This command gets all policy set definitions in category "Virtual Machine".
Expand Down
12 changes: 6 additions & 6 deletions src/Resources/Resources/help/Get-AzResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The **Get-AzResource** cmdlet gets Azure resources.
### Example 1: Get all resources in the current subscription

```powershell
Get-AzResource | ft
Get-AzResource | Format-Table
```

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

```powershell
Get-AzResource -ResourceGroupName testRG | ft
Get-AzResource -ResourceGroupName testRG | Format-Table
```

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

```powershell
Get-AzResource -ResourceGroupName other* | ft
Get-AzResource -ResourceGroupName other* | Format-Table
```

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

```powershell
Get-AzResource -Name testVM | fl
Get-AzResource -Name testVM | Format-List
```

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

```powershell
Get-AzResource -Name test* | ft
Get-AzResource -Name test* | Format-Table
```

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

```powershell
Get-AzResource -ResourceType Microsoft.Compute/virtualMachines | ft
Get-AzResource -ResourceType Microsoft.Compute/virtualMachines | Format-Table
```

```output
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/Resources/help/Get-AzResourceGroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ Get-AzResourceGroup -Tag @{'environment'='prod'}
### Example 4: Show the Resource groups by location
```powershell
Get-AzResourceGroup |
Sort Location,ResourceGroupName |
Format-Table -GroupBy Location ResourceGroupName,ProvisioningState,Tags
Sort-Object Location,ResourceGroupName |
Format-Table -GroupBy Location ResourceGroupName,ProvisioningState,Tags
```

### Example 5: Show the names of all the Resource groups in a particular location
```powershell
Get-AzResourceGroup -Location westus2 |
Sort ResourceGroupName |
Format-Wide ResourceGroupName -Column 4
Sort-Object ResourceGroupName |
Format-Wide ResourceGroupName -Column 4
```

### Example 6: Show the Resource groups whose names begin with WebServer
Expand Down
5 changes: 2 additions & 3 deletions src/Resources/Resources/help/Get-AzTag.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ Using the *Detailed* parameter is the equivalent of using the *Name* parameter f
### Example 4: Get the entire set of tags on a subscription

```powershell
Get-AzTag -ResourceId /subscriptions/{subId}
```
Get-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

isra-fel marked this conversation as resolved.
Show resolved Hide resolved
```output
Id : {Id}
Expand All @@ -134,7 +133,7 @@ This command gets the entire set of tags on the subscription with {subId}.
### Example 5: Get the entire set of tags on a resource

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

```output
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/Resources/help/Invoke-AzResourceAction.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ To get a list of supported actions, use the Azure Resource Explorer tool.
### Example 1: Invoke starting a VM with ResourceId

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

```output
Confirm
Are you sure you want to invoke the 'start' action on the following resource: /subscriptions/{subId}/resourceGroups/testGroup/providers/Microsoft.Compute/virtualMachines/testVM
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
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
```

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

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

```output
id : /subscriptions/{subId}/providers/Microsoft.Network
id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Network
namespace : Microsoft.Network
authorizations : {…}
resourceTypes : {@{resourceType=virtualNetworks; locations=System.Object[]; apiVersions=System.Object[]},
Expand Down
6 changes: 2 additions & 4 deletions src/Resources/Resources/help/New-AzDeployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,11 @@ Template parameter values that you enter at the command prompt take precedence o

### Example 1: Use a custom template and parameter file to create a deployment
```powershell
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";}
New-AzDeployment -Location "West US" -TemplateFile "D:\Azure\Templates\EngineeringSite.json" -TemplateParameterFile "D:\Azure\Templates\EngSiteParms.json" -Tag @{"key1"="value1"; "key2"="value2";}
```

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.
The command uses the *TemplateFile* parameter to specify the template and the *TemplateParameterFile* parameter to specify a file that contains parameters and parameter values.
It uses the *TemplateVersion* parameter to specify the version of the template.

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

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.
The first two commands read the text for the template file on disk and convert it to an in-memory hashtable.
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.
It uses the *TemplateVersion* parameter to specify the version of the template.

## PARAMETERS

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/Resources/help/New-AzPolicyAssignment.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ The final command assigns the policy in $Policy at the level of the resource gro
```powershell
$ResourceGroup = Get-AzResourceGroup -Name 'ResourceGroup11'
$Policy = Get-AzPolicyDefinition -BuiltIn | Where-Object {$_.Properties.DisplayName -eq 'Allowed locations'}
$Locations = Get-AzLocation | where displayname -like '*east*'
$Locations = Get-AzLocation | Where-Object displayname -like '*east*'
$AllowedLocations = @{'listOfAllowedLocations'=($Locations.location)}
New-AzPolicyAssignment -Name 'RestrictLocationPolicyAssignment' -PolicyDefinition $Policy -Scope $ResourceGroup.ResourceId -PolicyParameterObject $AllowedLocations
```
Expand Down
11 changes: 9 additions & 2 deletions src/Resources/Resources/help/New-AzTag.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,16 @@ If the tag name exists, **New-AzTag** adds the value to the existing tag instead
### Example 4: Use a predefined tag
```powershell
New-AzTag -Name "CostCenter" -Value "0001"

Name: CostCenter
Count: 0
Values:
Name Count
========= =====
0001 0

Set-AzResourceGroup -Name "EngineerBlog" -Tag @{Name="CostCenter";Value="0001"}

Name: EngineerBlog
Location: East US
Resources:
Expand All @@ -127,14 +130,18 @@ Tags:
Name Value
========== =====
CostCenter 0001

Get-AzTag -Name "CostCenter"

Name: CostCenter
Count: 1
Values:
Name Count
========= =====
0001 1

Get-AzResourceGroup -Tag @{Name="CostCenter"}

Name: EngineerBlog
Location: East US
Resources:
Expand All @@ -156,7 +163,7 @@ The commands in this example create and use a predefined tag.

```powershell
$Tags = @{"tagKey1"="tagValue1"; "tagKey2"="tagValue2"}
New-AzTag -ResourceId /subscriptions/{subId} -Tag $Tags
New-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -Tag $Tags
```

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

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

```output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The **Remove-AzResourceGroupDeployment** cmdlet removes an Azure resource group
### Example 1: Removes a resource group deployment with ResourceId

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

```output
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/Resources/help/Remove-AzTag.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ If the value has been applied to any resources or resource groups, the command f
### Example 3: Deletes the entire set of tags on a subscription

```powershell
Remove-AzTag -ResourceId /subscriptions/{subId}
Remove-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
```

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".

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

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

```output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This command gets the deployment template from TestDeployment and saves it as a

### Example 2: Get a deployment and save its template
```powershell
Get-AzManagementGroupDeploymentTemplate -ManagementGroupId "myMG" -Name "RolesDeployment" | Save-AzManagementGroupDeploymentTemplate
Get-AzManagementGroupDeployment -ManagementGroupId "myMG" -Name "RolesDeployment" | Save-AzManagementGroupDeploymentTemplate
```

This command gets the deployment "RolesDeployment" at the management group "myMG" and saves its template.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This command gets the deployment template from TestDeployment and saves it as a

### Example 2: Get a deployment and save its template
```powershell
Get-AzTenantDeploymentTemplate -Name "RolesDeployment" | Save-AzTenantDeploymentTemplate
Get-AzTenantDeployment -Name "RolesDeployment" | Save-AzTenantDeploymentTemplate
```

This command gets the deployment "RolesDeployment" at the current tenant scope and saves its template.
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/Resources/help/Set-AzPolicyAssignment.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ The final command assigns the user assigned managed identity identified by the *

### Example 4: Update policy assignment parameters with new policy parameter object
```powershell
$Locations = Get-AzLocation | where {($_.displayname -like 'france*') -or ($_.displayname -like 'uk*')}
$Locations = Get-AzLocation | Where-Object {($_.displayname -like 'france*') -or ($_.displayname -like 'uk*')}
$AllowedLocations = @{'listOfAllowedLocations'=($Locations.location)}
$PolicyAssignment = Get-AzPolicyAssignment -Name 'PolicyAssignment'
Set-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -PolicyParameterObject $AllowedLocations
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/Resources/help/Set-AzPolicySetDefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The **Set-AzPolicySetDefinition** cmdlet modifies a policy definition.
### Example 1: Update the description of a policy set definition
```powershell
$PolicySetDefinition = Get-AzPolicySetDefinition -ResourceId '/subscriptions/mySub/Microsoft.Authorization/policySetDefinitions/myPSSetDefinition'
Set-AzPolicySetDefinition -Id $PolicySetDefinition.ResourceId -Description 'Updated policy to not allow virtual machine creation'
Set-AzPolicySetDefinition -Id $PolicySetDefinition.ResourceId -Description 'Updated policy to not allow virtual machine creation'
```

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

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

Expand Down
4 changes: 2 additions & 2 deletions src/Resources/Resources/help/Update-AzManagementGroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The **Update-AzManagementGroup** cmdlet updates the **ParentId** or **DisplayNam

### Example 1: Update a Management Group's Display Name
```powershell
Update-AzManagementGroup -Group "TestGroup" -DisplayName "New Display Name"
Update-AzManagementGroup -GroupName "TestGroup" -DisplayName "New Display Name"
```

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

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

```output
Expand Down
12 changes: 6 additions & 6 deletions src/Resources/Resources/help/Update-AzTag.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This operation allows replacing, merging or selectively deleting tags on the spe

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

```output
Expand All @@ -45,13 +45,13 @@ Properties :
key3 value3
```

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

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

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

```output
Expand All @@ -65,13 +65,13 @@ Properties :
key3 value3
```

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

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

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

```output
Expand All @@ -84,7 +84,7 @@ Properties :
key3 value3
```

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

## PARAMETERS

Expand Down