Skip to content

Commit 133f0bd

Browse files
authored
Merge pull request #109336 from DCtheGeek/dmc-policy-cleanupafterpm
Language and Acrolinx cleanup
2 parents c748245 + 4516401 commit 133f0bd

File tree

2 files changed

+49
-43
lines changed

2 files changed

+49
-43
lines changed

articles/governance/policy/how-to/guest-configuration-create-linux.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ To learn about creating Guest Configuration policies for Windows, see the page
1414

1515
When auditing Linux, Guest Configuration uses [Chef InSpec](https://www.inspec.io/). The InSpec
1616
profile defines the condition that the machine should be in. If the evaluation of the configuration
17-
fails, the Policy effect **auditIfNotExists** is triggered and the machine is considered
17+
fails, the policy effect **auditIfNotExists** is triggered and the machine is considered
1818
**non-compliant**.
1919

2020
[Azure Policy Guest Configuration](../concepts/guest-configuration.md) can only be used to audit
@@ -28,13 +28,15 @@ non-Azure machine.
2828
2929
## Install the PowerShell module
3030

31-
Creating a Guest Configuration artifact, automated testing of the artifact, creating
32-
a policy definition, and publishing the policy, is entirely automatable using the Guest Configuration module in PowerShell. The module can be installed on a machine running Windows, macOS, or Linux with PowerShell 6.2 or later
33-
running locally, or with [Azure Cloud Shell](https://shell.azure.com), or with the
31+
Creating a Guest Configuration artifact, automated testing of the artifact, creating a policy
32+
definition, and publishing the policy, is entirely automatable using the Guest Configuration module
33+
in PowerShell. The module can be installed on a machine running Windows, macOS, or Linux with
34+
PowerShell 6.2 or later running locally, or with [Azure Cloud Shell](https://shell.azure.com), or
35+
with the
3436
[Azure PowerShell Core Docker image](https://hub.docker.com/r/azuresdk/azure-powershell-core).
3537

3638
> [!NOTE]
37-
> Compilation of configurations is not yet supported on Linux.
39+
> Compilation of configurations isn't supported on Linux.
3840
3941
### Base requirements
4042

@@ -186,7 +188,7 @@ Test- cmdlet on the same OS platform as you plan to audit.
186188

187189
Parameters of the `Test-GuestConfigurationPackage` cmdlet:
188190

189-
- **Name**: Guest Configuration Policy name.
191+
- **Name**: Guest Configuration policy name.
190192
- **Parameter**: Policy parameters provided in hashtable format.
191193
- **Path**: Full path of the Guest Configuration package.
192194

@@ -330,10 +332,10 @@ and [Azure PowerShell](../assign-policy-powershell.md).
330332
> assigned, the prerequisites aren't deployed and the policy always shows that '0' servers are
331333
> compliant.
332334
333-
Assigning an Azure Policy with _DeployIfNotExists_ type requires an additional level of access.
334-
To grant the least privilege, you can create a custom role definition
335-
that extends **Resource Policy Contributor**. The example below creates a role named
336-
**Resource Policy Contributor DINE** with the additional permission _Microsoft.Authorization/roleAssignments/write_.
335+
Assigning an policy definition with _DeployIfNotExists_ effect requires an additional level of
336+
access. To grant the least privilege, you can create a custom role definition that extends
337+
**Resource Policy Contributor**. The example below creates a role named **Resource Policy
338+
Contributor DINE** with the additional permission _Microsoft.Authorization/roleAssignments/write_.
337339

338340
```azurepowershell-interactive
339341
$subscriptionid = '00000000-0000-0000-0000-000000000000'
@@ -356,9 +358,10 @@ override values are provided through Azure Policy and don't impact how the Confi
356358
authored or compiled.
357359

358360
With InSpec, parameters are typically handled as input either at runtime or as code using
359-
attributes. Guest Configuration obfuscates this process so input can be provided when policy is assigned. An attributes file is automatically created within the machine. You
360-
don't need to create and add a file in your project. There are two steps to adding parameters to
361-
your Linux audit project.
361+
attributes. Guest Configuration obfuscates this process so input can be provided when policy is
362+
assigned. An attributes file is automatically created within the machine. You don't need to create
363+
and add a file in your project. There are two steps to adding parameters to your Linux audit
364+
project.
362365

363366
Define the input in the Ruby file where you script what to audit on the machine. An example is given
364367
below.
@@ -376,8 +379,8 @@ parameter named **Parameters**. This parameter takes a hashtable including all d
376379
about each parameter and automatically creates all the required sections of the files used to create
377380
each Azure Policy definition.
378381

379-
The following example creates an Azure Policy to audit a file path, where the user provides the path
380-
at the time of Policy assignment.
382+
The following example creates an policy definition to audit a file path, where the user provides the
383+
path at the time of policy assignment.
381384

382385
```azurepowershell-interactive
383386
$PolicyParameterInfo = @(
@@ -392,7 +395,7 @@ $PolicyParameterInfo = @(
392395
}
393396
)
394397
395-
# The hashtable also supports a property named 'AllowedValues' with an array of strings if you would like to limit input to a list
398+
# The hashtable also supports a property named 'AllowedValues' with an array of strings to limit input to a list
396399
397400
New-GuestConfigurationPolicy
398401
-ContentUri 'https://storageaccountname.blob.core.windows.net/packages/AuditFilePathExists.zip?st=2019-07-01T00%3A00%3A00Z&se=2024-07-01T00%3A00%3A00Z&sp=rl&sv=2018-03-28&sr=b&sig=JdUf4nOCo8fvuflOoX%2FnGo4sXqVfP5BYXHzTl3%2BovJo%3D' `
@@ -425,24 +428,23 @@ Configuration AuditFilePathExists
425428

426429
## Policy lifecycle
427430

428-
If you would like to release an update to the Policy, there are two fields
429-
that require attention.
431+
To release an update to the policy definition, there are two fields that require attention.
430432

431433
- **Version**: When you run the `New-GuestConfigurationPolicy` cmdlet, you must specify a version
432434
number greater than what is currently published. The property updates the version of the Guest
433435
Configuration assignment so the agent recognizes the updated package.
434436
- **contentHash**: This property is updated automatically by the `New-GuestConfigurationPolicy`
435437
cmdlet. It's a hash value of the package created by `New-GuestConfigurationPackage`. The property
436-
must be correct for the `.zip` file you publish. If only the **contentUri** property is updated, the Extension won't accept the content package.
438+
must be correct for the `.zip` file you publish. If only the **contentUri** property is updated,
439+
the Extension won't accept the content package.
437440

438441
The easiest way to release an updated package is to repeat the process described in this article and
439442
provide an updated version number. That process guarantees all properties have been correctly
440443
updated.
441444

442445
## Optional: Signing Guest Configuration packages
443446

444-
Guest Configuration custom policies use SHA256 hash to validate the policy package hasn't
445-
changed.
447+
Guest Configuration custom policies use SHA256 hash to validate the policy package hasn't changed.
446448
Optionally, customers may also use a certificate to sign packages and force the Guest Configuration
447449
extension to only allow signed content.
448450

articles/governance/policy/how-to/guest-configuration-create.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To learn about creating Guest Configuration policies for Linux, see the page
1515
When auditing Windows, Guest Configuration uses a
1616
[Desired State Configuration](/powershell/scripting/dsc/overview/overview) (DSC) resource module to
1717
and configuration file. The DSC configuration defines the condition that the machine should be in.
18-
If the evaluation of the configuration fails, the Policy effect **auditIfNotExists** is triggered
18+
If the evaluation of the configuration fails, the policy effect **auditIfNotExists** is triggered
1919
and the machine is considered **non-compliant**.
2020

2121
[Azure Policy Guest Configuration](../concepts/guest-configuration.md) can only be used to audit
@@ -29,9 +29,11 @@ non-Azure machine.
2929
3030
## Install the PowerShell module
3131

32-
Creating a Guest Configuration artifact, automated testing of the artifact, creating
33-
a policy definition, and publishing the policy, is entirely automatable using the Guest Configuration module in PowerShell. The module can be installed on a machine running Windows, macOS, or Linux with PowerShell 6.2 or later
34-
running locally, or with [Azure Cloud Shell](https://shell.azure.com), or with the
32+
Creating a Guest Configuration artifact, automated testing of the artifact, creating a policy
33+
definition, and publishing the policy, is entirely automatable using the Guest Configuration module
34+
in PowerShell. The module can be installed on a machine running Windows, macOS, or Linux with
35+
PowerShell 6.2 or later running locally, or with [Azure Cloud Shell](https://shell.azure.com), or
36+
with the
3537
[Azure PowerShell Core Docker image](https://hub.docker.com/r/azuresdk/azure-powershell-core).
3638

3739
> [!NOTE]
@@ -74,9 +76,9 @@ To install the **GuestConfiguration** module in PowerShell:
7476
## Guest Configuration artifacts and policy for Windows
7577

7678
Guest Configuration uses PowerShell Desired State Configuration as a language abstraction for
77-
writing what to audit in Windows. The agent loads a standalone instance of PowerShell 6.2, so there's no conflict with usage of
78-
PowerShell DSC in Windows PowerShell 5.1, and there's no requirement to pre-install PowerShell 6.2
79-
or later.
79+
writing what to audit in Windows. The agent loads a standalone instance of PowerShell 6.2, so there
80+
isn't conflict with usage of PowerShell DSC in Windows PowerShell 5.1, and there's no requirement to
81+
pre-install PowerShell 6.2 or later.
8082

8183
For an overview of DSC concepts and terminology, see
8284
[PowerShell DSC Overview](/powershell/scripting/dsc/overview/overview).
@@ -232,7 +234,7 @@ Test- cmdlet on the same OS platform as you plan to audit.
232234

233235
Parameters of the `Test-GuestConfigurationPackage` cmdlet:
234236

235-
- **Name**: Guest Configuration Policy name.
237+
- **Name**: Guest Configuration policy name.
236238
- **Parameter**: Policy parameters provided in hashtable format.
237239
- **Path**: Full path of the Guest Configuration package.
238240

@@ -348,11 +350,12 @@ Finally, publish the policy definitions using the `Publish-GuestConfigurationPol
348350
cmdlet only has the **Path** parameter that points to the location of the JSON files created by
349351
`New-GuestConfigurationPolicy`.
350352

351-
To run the Publish command, you need access to create Policies in Azure. The specific authorization requirements are documented in the [Azure Policy Overview](../overview.md) page. The best built-in role is **Resource Policy Contributor**.
353+
To run the Publish command, you need access to create policies in Azure. The specific authorization
354+
requirements are documented in the [Azure Policy Overview](../overview.md) page. The best built-in
355+
role is **Resource Policy Contributor**.
352356

353357
```azurepowershell-interactive
354-
Publish-GuestConfigurationPolicy `
355-
-Path '.\policyDefinitions'
358+
Publish-GuestConfigurationPolicy -Path '.\policyDefinitions'
356359
```
357360

358361
The `Publish-GuestConfigurationPolicy` cmdlet accepts the path from the PowerShell pipeline. This
@@ -377,10 +380,10 @@ initiative with [Portal](../assign-policy-portal.md), [Azure CLI](../assign-poli
377380
> assigned, the prerequisites aren't deployed and the policy always shows that '0' servers are
378381
> compliant.
379382
380-
Assigning an Azure Policy with _DeployIfNotExists_ type requires an additional level of access.
381-
To grant the least privilege, you can create a custom role definition
382-
that extends **Resource Policy Contributor**. The example below creates a role named
383-
**Resource Policy Contributor DINE** with the additional permission _Microsoft.Authorization/roleAssignments/write_.
383+
Assigning an policy definition with _DeployIfNotExists_ effect requires an additional level of
384+
access. To grant the least privilege, you can create a custom role definition that extends
385+
**Resource Policy Contributor**. The example below creates a role named **Resource Policy
386+
Contributor DINE** with the additional permission _Microsoft.Authorization/roleAssignments/write_.
384387

385388
```azurepowershell-interactive
386389
$subscriptionid = '00000000-0000-0000-0000-000000000000'
@@ -404,10 +407,11 @@ authored or compiled.
404407

405408
The cmdlets `New-GuestConfigurationPolicy` and `Test-GuestConfigurationPolicyPackage` include a
406409
parameter named **Parameters**. This parameter takes a hashtable definition including all details
407-
about each parameter and creates the required sections of each file used for the Azure Policy definition.
410+
about each parameter and creates the required sections of each file used for the Azure Policy
411+
definition.
408412

409-
The following example creates an Azure Policy to audit a service, where the user selects from a
410-
list when the Policy is assigned.
413+
The following example creates a policy definition to audit a service, where the user selects from a
414+
list at the time of policy assignment.
411415

412416
```azurepowershell-interactive
413417
$PolicyParameterInfo = @(
@@ -434,15 +438,15 @@ New-GuestConfigurationPolicy
434438

435439
## Policy lifecycle
436440

437-
If you would like to release an update to the Policy, there are two fields
438-
that require attention.
441+
If you would like to release an update to the policy, there are two fields that require attention.
439442

440443
- **Version**: When you run the `New-GuestConfigurationPolicy` cmdlet, you must specify a version
441444
number greater than what is currently published. The property updates the version of the Guest
442445
Configuration assignment so the agent recognizes the updated package.
443446
- **contentHash**: This property is updated automatically by the `New-GuestConfigurationPolicy`
444447
cmdlet. It's a hash value of the package created by `New-GuestConfigurationPackage`. The property
445-
must be correct for the `.zip` file you publish. If only the **contentUri** property is updated, the Extension won't accept the content package.
448+
must be correct for the `.zip` file you publish. If only the **contentUri** property is updated,
449+
the Extension won't accept the content package.
446450

447451
The easiest way to release an updated package is to repeat the process described in this article and
448452
provide an updated version number. That process guarantees all properties have been correctly
@@ -487,7 +491,7 @@ GuestConfiguration agent expects the certificate public key to be present in "Tr
487491
Certificate Authorities" on Windows machines and in the path
488492
`/usr/local/share/ca-certificates/extra` on Linux machines. For the node to verify signed content,
489493
install the certificate public key on the machine before applying the custom policy. This process
490-
can be done using any technique inside the VM, or by using Azure Policy. An example template is
494+
can be done using any technique inside the VM or by using Azure Policy. An example template is
491495
[provided here](https://github.com/Azure/azure-quickstart-templates/tree/master/201-vm-push-certificate-windows).
492496
The Key Vault access policy must allow the Compute resource provider to access certificates during
493497
deployments. For detailed steps, see

0 commit comments

Comments
 (0)