Skip to content

Commit 7b2f66a

Browse files
committed
Add new conceptual docs for configuring DSC settings
1 parent 73c95ca commit 7b2f66a

File tree

1 file changed

+367
-0
lines changed

1 file changed

+367
-0
lines changed
Lines changed: 367 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,367 @@
1+
---
2+
description: >-
3+
Learn how to configure DSC's behavior using the settings system, including default settings,
4+
user settings, and policy settings for administrative control.
5+
ms.date: 08/12/2025
6+
title: Configure DSC settings
7+
---
8+
9+
# Configure DSC settings
10+
11+
Microsoft's Desired State Configuration (DSC) platform uses a layered settings system that allows
12+
you to customize its behavior. You can control various aspects of DSC operation through JSON
13+
configuration files that are evaluated in a specific priority order.
14+
15+
Understanding how to configure DSC settings enables you to:
16+
17+
- Customize DSC's default behavior for your environment
18+
- Set user-specific preferences for development workflows
19+
- Implement organization-wide policies that override user settings
20+
- Control resource discovery paths and execution parameters
21+
22+
## Settings file hierarchy
23+
24+
DSC evaluates settings files in the following priority order, with later files overriding earlier
25+
ones:
26+
27+
1. **Default settings** - Built-in configuration shipped with DSC
28+
2. **User settings** - Custom configuration you create
29+
3. **Policy settings** - Administrative settings that override all others
30+
31+
This layered approach ensures that administrators can enforce organization-wide policies while
32+
still allowing users to customize their local DSC experience within those constraints.
33+
34+
### Default settings file
35+
36+
DSC ships with a default settings file named `dsc_default.settings.json` located in the same
37+
directory as the DSC executable. This file contains the baseline configuration that DSC uses when
38+
no other settings are specified.
39+
40+
> [!IMPORTANT]
41+
> Don't modify the default settings file directly. Your changes will be lost when you update DSC.
42+
> Instead, use the user settings file to override specific values.
43+
44+
### User settings file
45+
46+
Create a file named `dsc.settings.json` in the same directory as the DSC executable to override
47+
default settings. This file should contain only the settings you want to change, not a complete
48+
copy of the default settings.
49+
50+
The user settings file is where you define your personal preferences and development-specific
51+
configurations. Common use cases include:
52+
53+
- Customizing resource discovery paths
54+
- Setting default execution parameters
55+
- Configuring logging levels for development
56+
57+
### Policy settings file
58+
59+
Administrators can create a policy settings file that overrides both default and user settings.
60+
This file ensures that certain organizational requirements are enforced regardless of user
61+
preferences.
62+
63+
The policy settings file location depends on your operating system:
64+
65+
- **Windows**: `%ProgramData%\dsc\dsc.settings.json`
66+
- **Linux/macOS**: `/etc/dsc/dsc.settings.json`
67+
68+
Policy files are typically writable only by administrators but readable by all users, ensuring
69+
that organizational policies can't be bypassed by individual users.
70+
71+
> [!IMPORTANT]
72+
> Policy settings are designed for organizational environments and illustrated purposes only.
73+
> They cannot be enforced for users with administrator privileges and are not managed by
74+
> enterprise tools like Group Policy Management. Users with sufficient privileges can modify
75+
> or override policy settings on their local systems.
76+
77+
## Settings file format
78+
79+
DSC settings files use a versioned JSON format. The root object contains a version number as the
80+
key, with all settings nested under that version. This structure allows DSC to maintain backward
81+
compatibility as the settings schema evolves.
82+
83+
```json
84+
{
85+
"1": {
86+
"resourcePath": {
87+
"allowEnvOverride": true,
88+
"appendEnvPath": true,
89+
"directories": []
90+
},
91+
"tracing": {
92+
"level": "WARN",
93+
"format": "Default",
94+
"allowOverride": true
95+
}
96+
}
97+
}
98+
```
99+
100+
> [!NOTE]
101+
> Settings files must contain valid JSON. Comments are not supported in JSON, so document your
102+
> configuration choices in separate documentation files. The version number "1" corresponds to
103+
> the current settings schema version and must be included as the root key.
104+
105+
## Available settings
106+
107+
DSC supports the following configuration settings organized by category:
108+
109+
### Resource path settings
110+
111+
The `resourcePath` setting controls how DSC discovers and loads resources from the file system.
112+
113+
```json
114+
{
115+
"1": {
116+
"resourcePath": {
117+
"allowEnvOverride": true,
118+
"appendEnvPath": true,
119+
"directories": [
120+
"C:\\CustomResources",
121+
"C:\\CompanyResources"
122+
]
123+
}
124+
}
125+
}
126+
```
127+
128+
**Properties:**
129+
130+
- `allowEnvOverride` (boolean): Whether to allow the `DSC_RESOURCE_PATH` environment variable to
131+
override the configured directories. When `true`, the environment variable takes precedence over
132+
the `directories` setting. When `false`, only the configured directories are used.
133+
134+
- `appendEnvPath` (boolean): Whether to append the system's `PATH` environment variable to the
135+
resource search paths. When `true`, DSC searches both the configured directories and all
136+
directories in the system PATH. This setting is ignored when `allowEnvOverride` is `true` and
137+
the `DSC_RESOURCE_PATH` environment variable is set.
138+
139+
- `directories` (array of strings): Custom directories where DSC should search for resource
140+
manifests and executables. These paths are searched before the system PATH when
141+
`appendEnvPath` is `true`.
142+
143+
### Tracing settings
144+
145+
The `tracing` setting controls DSC's logging and diagnostic output behavior.
146+
147+
```json
148+
{
149+
"1": {
150+
"tracing": {
151+
"level": "WARN",
152+
"format": "Default",
153+
"allowOverride": true
154+
}
155+
}
156+
}
157+
```
158+
159+
**Properties:**
160+
161+
- `level` (string): The minimum log level to output. Valid values are `ERROR`, `WARN`, `INFO`,
162+
`DEBUG`, and `TRACE`. Higher levels include all lower-level messages (e.g., `WARN` includes
163+
`ERROR` messages).
164+
165+
- `format` (string): The format for log output. Valid values are `default` for standard
166+
console output, `plaintext` for unformatted text output, and `json` for structured JSON logging.
167+
168+
- `allowOverride` (boolean): Whether command-line arguments or environment variables can override
169+
the configured tracing level. When `false`, the configured level is enforced regardless of
170+
other settings.
171+
172+
## Common settings scenarios
173+
174+
### Example 1 - Custom resource paths
175+
176+
Configure additional directories where DSC should search for resources:
177+
178+
```json
179+
{
180+
"1": {
181+
"resourcePath": {
182+
"allowEnvOverride": true,
183+
"appendEnvPath": true,
184+
"directories": [
185+
"C:\\CustomResources",
186+
"C:\\CompanyResources\\Production"
187+
]
188+
}
189+
}
190+
}
191+
```
192+
193+
This setting extends the default resource discovery mechanism to include your custom resource
194+
locations, making them available for use in configuration documents.
195+
196+
### Example 2 - Development environment configuration
197+
198+
Create a user settings file optimized for development work:
199+
200+
```json
201+
{
202+
"1": {
203+
"resourcePath": {
204+
"allowEnvOverride": true,
205+
"appendEnvPath": true,
206+
"directories": [
207+
"C:\\Development\\MyResources",
208+
"C:\\Development\\TestResources"
209+
]
210+
},
211+
"tracing": {
212+
"level": "DEBUG",
213+
"format": "Default",
214+
"allowOverride": true
215+
}
216+
}
217+
}
218+
```
219+
220+
This configuration increases logging verbosity for troubleshooting, adds development resource
221+
paths, and maintains flexibility for environment variable overrides.
222+
223+
### Example 3 - Organization-wide policy enforcement
224+
225+
An administrator might create a policy settings file to enforce security and compliance
226+
requirements:
227+
228+
```json
229+
{
230+
"1": {
231+
"resourcePath": {
232+
"allowEnvOverride": false,
233+
"appendEnvPath": false,
234+
"directories": [
235+
"\\\\CompanyShare\\ApprovedResources"
236+
]
237+
},
238+
"tracing": {
239+
"level": "WARN",
240+
"format": "Default",
241+
"allowOverride": false
242+
}
243+
}
244+
}
245+
```
246+
247+
This policy configuration restricts resource usage to approved company resources, disables
248+
environment variable overrides for security, and prevents users from changing tracing settings.
249+
250+
## Best practices
251+
252+
### Use minimal configuration files
253+
254+
Only include settings you need to change in your configuration files. This approach:
255+
256+
- Makes your configuration easier to understand and maintain
257+
- Reduces conflicts when DSC updates change default values
258+
- Clearly shows which settings you've customized
259+
260+
### Document your settings choices
261+
262+
Keep documentation alongside your settings files explaining:
263+
264+
- Why you changed specific settings
265+
- What impact the changes have on DSC behavior
266+
- Any dependencies between settings
267+
268+
### Test settings changes carefully
269+
270+
Before deploying settings changes:
271+
272+
- Test them in a development environment first
273+
- Verify that existing configuration documents still work correctly
274+
- Check that the settings produce the expected behavior changes
275+
276+
### Use policy settings judiciously
277+
278+
Policy settings override all user preferences, so use them only for:
279+
280+
- Security requirements that must be enforced
281+
- Compliance settings that users shouldn't override
282+
- Organization-wide standards that ensure consistency
283+
284+
## Troubleshooting settings
285+
286+
### Verify settings are being loaded
287+
288+
Use DSC's debug logging to verify which settings files are being read and which values are being
289+
applied. Enable debug logging in your user settings:
290+
291+
```json
292+
{
293+
"1": {
294+
"tracing": {
295+
"level": "DEBUG",
296+
"format": "Default",
297+
"allowOverride": true
298+
}
299+
}
300+
}
301+
```
302+
303+
When debug logging is enabled, DSC outputs detailed information about:
304+
305+
- Which settings files are being loaded and from what locations
306+
- The final resolved values for each setting after applying the hierarchy
307+
- Whether environment variables are overriding configured values
308+
309+
### Check file locations and permissions
310+
311+
Ensure that:
312+
313+
- Settings files are in the correct locations (same directory as DSC executable for user settings)
314+
- Files have proper read permissions for the user running DSC
315+
- JSON syntax is valid
316+
- The version number "1" is included as the root key in the JSON structure
317+
318+
### Understanding setting precedence
319+
320+
Remember the priority order when troubleshooting unexpected behavior:
321+
322+
1. Policy settings always win
323+
2. User settings override defaults
324+
3. Default settings provide the baseline
325+
326+
If a setting isn't working as expected, check whether it's being overridden by a higher-priority
327+
file.
328+
329+
## Security considerations
330+
331+
### Protect sensitive settings
332+
333+
If your settings files contain sensitive information:
334+
335+
- Use appropriate file system permissions
336+
- Consider using environment variables or secure storage for sensitive values
337+
- Avoid storing credentials directly in settings files
338+
339+
Currently, DSC's available settings do not contain sensitive data, but future versions may
340+
introduce settings that include credentials, tokens, or other sensitive information.
341+
342+
> [!WARNING]
343+
> When using `TRACE` level logging, DSC may output sensitive data including configuration values,
344+
> resource parameters, and system information. Use TRACE logging only in secure development
345+
> environments and avoid it in production systems where sensitive data could be exposed.
346+
347+
### Policy file security
348+
349+
Policy settings files should be:
350+
351+
- Writable only by administrators
352+
- Readable by all users who need to run DSC
353+
- Protected from unauthorized modification
354+
355+
The default policy file locations provide this security model, but verify permissions match your
356+
organization's security requirements.
357+
358+
## Related content
359+
360+
- [DSC Configuration document overview][01]
361+
- [DSC Resource anatomy][02]
362+
- [Improve the accessibility of DSC output in PowerShell][03]
363+
364+
<!-- Link reference definitions -->
365+
[01]: ./configuration-documents/overview.md
366+
[02]: ./resources/anatomy.md
367+
[03]: ./output-accessibility.md

0 commit comments

Comments
 (0)