Skip to content

Commit 2a90471

Browse files
committed
Fix examples
1 parent c7bdc35 commit 2a90471

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

src/Resources/ResourceManager/Implementation/Policy/NewAzurePolicyAssignment.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
1616
{
1717
using System;
1818
using System.Collections;
19+
using System.Linq;
1920
using System.Management.Automation;
2021

2122
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
@@ -27,7 +28,6 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2728

2829
using Newtonsoft.Json.Linq;
2930
using Policy;
30-
using System.Linq;
3131

3232
/// <summary>
3333
/// Creates a policy assignment.

src/Resources/ResourceManager/Implementation/Policy/SetAzurePolicyAssignment.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ private JToken GetResource(string resourceId, string apiVersion)
178178

179179
// get incoming object properties if present
180180
JObject inputMetadata = null;
181-
182181
if (this.InputObject != null)
183182
{
184183
var newProperties = this.InputObject.Properties.ToJToken();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,11 @@ The assignment is set with an EnforcementMode value of _DoNotEnforce_ i.e. the p
157157
```
158158
PS C:\> $PolicySet = Get-AzPolicySetDefinition -Name 'VirtualMachinePolicySet'
159159
PS C:\> $NonComplianceMessages = @(@{Message="Only DsV2 SKUs are allowed."; PolicyDefinitionReferenceId="DefRef1"}, @{Message="Virtual machines must follow cost management best practices."})
160-
PS C:\> New-AzPolicyAssignment -Name 'VirtualMachinePolicyAssignment' -PolicyDefinition $Policy -NonComplianceMessage $NonComplianceMessages
160+
PS C:\> New-AzPolicyAssignment -Name 'VirtualMachinePolicyAssignment' -PolicySetDefinition $PolicySet -NonComplianceMessage $NonComplianceMessages
161161
```
162162

163163
The first command gets the policy set definition named VirtualMachinePolicy by using the Get-AzPolicySetDefinition cmdlet and stores it in the $PolicySet variable.
164-
The second command creates an array of non-compliance messages. One general purpose message for the entire assignment and one message specific to a naming restriction policy within the assigned policy set definition.
164+
The second command creates an array of non-compliance messages. One general purpose message for the entire assignment and one message specific to a SKU restriction policy within the assigned policy set definition.
165165
The final command assigns the policy set definition in $PolicySet to the subscription with two non-compliance messages that will be shown if a resource is denied by policy.
166166

167167
## PARAMETERS

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ The final command updates the enforcementMode property on the policy assignment
152152
### Example 6: Update non-compliance messages
153153
```
154154
PS C:\> $PolicyAssignment = Get-AzPolicyAssignment -Name 'VirtualMachinePolicy'
155-
PS C:\> Set-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -NonComplianceMessage @{Message="All resources must follow resource naming guidelines."},
155+
PS C:\> Set-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -NonComplianceMessage @{Message="All resources must follow resource naming guidelines."}
156156
```
157157

158158
The first command gets the policy assignment named VirtualMachinePolicy by using the Get-AzPolicyAssignment cmdlet and stores it in the $PolicyAssignment variable.

0 commit comments

Comments
 (0)