Skip to content

Commit bc92b11

Browse files
authored
Merge pull request #111187 from mgreenegit/patch-8
feedback from community
2 parents 201c2ad + e6c67b3 commit bc92b11

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

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

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,14 @@ For an overview of DSC concepts and terminology, see
8585

8686
### How Guest Configuration modules differ from Windows PowerShell DSC modules
8787

88-
When Guest Configuration audits a machine, it first runs `Test-TargetResource` to determine if it is
89-
in the correct state. The boolean value returned by the function determines if the Azure Resource
90-
Manager status for the Guest Assignment should be Compliant/Not-Compliant. Next the provider runs
91-
`Get-TargetResource` to return the current state of each setting so details are available both about
92-
why a machine isn't compliant, or to confirm that the current state is compliant.
88+
When Guest Configuration audits a machine:
89+
90+
1. The agent first runs `Test-TargetResource` to determine if the configuration is
91+
in the correct state.
92+
1. The boolean value returned by the function determines if the Azure Resource
93+
Manager status for the Guest Assignment should be Compliant/Not-Compliant.
94+
1. The provider runs `Get-TargetResource` to return the current state of each setting so details are available both about
95+
why a machine isn't compliant and to confirm that the current state is compliant.
9396

9497
### Get-TargetResource requirements
9598

@@ -128,6 +131,25 @@ return @{
128131
reasons = $reasons
129132
}
130133
```
134+
135+
The Reasons property must also be added to the schema MOF for the resource as an embedded class.
136+
137+
```mof
138+
[ClassVersion("1.0.0.0")]
139+
class Reason
140+
{
141+
[Read] String Phrase;
142+
[Read] String Code;
143+
};
144+
145+
[ClassVersion("1.0.0.0"), FriendlyName("ResourceName")]
146+
class ResourceName : OMI_BaseResource
147+
{
148+
[Key, Description("Example description")] String Example;
149+
[Read, EmbeddedInstance("Reason")] String Reasons[];
150+
};
151+
```
152+
131153
### Configuration requirements
132154

133155
The name of the custom configuration must be consistent everywhere. The name of
@@ -176,7 +198,7 @@ and not communicating with the service.
176198

177199
## Step by step, creating a custom Guest Configuration audit policy for Windows
178200

179-
Create a DSC configuration. The following PowerShell script example creates a configuration named
201+
Create a DSC configuration to audit settings. The following PowerShell script example creates a configuration named
180202
**AuditBitLocker**, imports the **PsDscResources** resource module, and uses the `Service` resource
181203
to audit for a running service. The configuration script can be executed from a Windows or macOS
182204
machine.
@@ -208,7 +230,7 @@ configuration makes it easy to organize many files when operating at scale.
208230
Once the MOF is compiled, the supporting files must be packaged together. The completed package is
209231
used by Guest Configuration to create the Azure Policy definitions.
210232

211-
The `New-GuestConfigurationPackage` cmdlet creates the package. Parameters of the
233+
The `New-GuestConfigurationPackage` cmdlet creates the package. Modules that are needed by the configuration must be in available in `$Env:PSModulePath`. Parameters of the
212234
`New-GuestConfigurationPackage` cmdlet when creating Windows content:
213235

214236
- **Name**: Guest Configuration package name.
@@ -230,7 +252,8 @@ development environment as is used inside Azure machines. Using this solution, y
230252
integration testing locally before releasing to billed cloud environments.
231253

232254
Since the agent is actually evaluating the local environment, in most cases you need to run the
233-
Test- cmdlet on the same OS platform as you plan to audit.
255+
Test- cmdlet on the same OS platform as you plan to audit. The test will only use modules that are included
256+
in the content package.
234257

235258
Parameters of the `Test-GuestConfigurationPackage` cmdlet:
236259

0 commit comments

Comments
 (0)