(GH-420) Add environment variable conceptual document - #421
Gijs Reijn (Gijsreyn) wants to merge 1 commit into
Conversation
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit 92339fd: ✅ Validation status: passed
For more details, please refer to the build report. |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved documentation corrections affect platform behavior, path resolution, discovery, and precedence guidance.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds a DSC 3.0 conceptual guide for environment variables and links it in the concepts navigation.
Changes:
- Documents environment-variable behavior, discovery, configuration, tracing, and precedence.
- Adds the article to the DSC 3.0 concepts table of contents.
File summaries
| File | Description |
|---|---|
dsc/docs-conceptual/dsc-3.0/concepts/toc.yml |
Adds the environment variables article to navigation. |
dsc/docs-conceptual/dsc-3.0/concepts/environment-variables.md |
Adds conceptual documentation for DSC environment variables. |
Review details
Suppressed comments (6)
dsc/docs-conceptual/dsc-3.0/concepts/environment-variables.md:71
- The later precedence section says
resourcePath.allowEnvOverridecontrols whether this variable is honored, but this introduction presents the restricted path as unconditional. With the setting disabled, these bullets are not the behavior users get; make the condition explicit here.
`DSC_RESTRICTED_PATH` is a stricter form of `DSC_RESOURCE_PATH`. When you define it, DSC:
dsc/docs-conceptual/dsc-3.0/concepts/environment-variables.md:239
systemRoot()is based on the WindowsSystemRootvalue (for example,C:\Windows), notSYSTEMDRIVE(which is the drive-only value such asC:\). This row currently documents the wrong variable and the wrong result.
| `SYSTEMDRIVE` | Windows | Default value of the `systemRoot()` function, such as `C:\`. |
dsc/docs-conceptual/dsc-3.0/concepts/environment-variables.md:124
- The
--filesyntax also uses--file -for stdin, so the first bullet is too broad: stdin has no containing document folder. Clarify that the first case is a real file path and include--file -in the stdin case to avoid documenting the wrongDSC_CONFIG_ROOTbehavior.
- When you specify a configuration document with the [`--file`][02] option, DSC sets
`DSC_CONFIG_ROOT` to the absolute path of the folder that contains the document.
- When you pass the configuration document with the `--input` option or from stdin, DSC keeps the
existing value of `DSC_CONFIG_ROOT` if the variable is already defined. Otherwise, DSC sets the
variable to the current working directory.
dsc/docs-conceptual/dsc-3.0/concepts/environment-variables.md:63
- The changelog says that when
DSC_RESOURCE_PATHis set, DSC restricts discovery of both manifests and the executables they reference to the listed paths (dsc/docs-conceptual/dsc-3.0/changelog.md:313-316). This paragraph instead says the DSC executable directory is added toPATHso shipped executables still work, which gives the opposite guidance. Revise this and the laterPATHdescription to distinguish child-process inheritance from DSC's restricted executable discovery.
When `DSC_RESOURCE_PATH` is defined, DSC still adds the folder that contains the `dsc` executable
to `PATH` if it isn't already there. This ensures that resource manifests that reference
executables shipped with DSC continue to work. DSC doesn't search that folder for manifests unless
you include it in `DSC_RESOURCE_PATH`.
dsc/docs-conceptual/dsc-3.0/concepts/environment-variables.md:244
- These two adapter references maintain their own caches (
PSAdapterCache.jsonandWindowsPSAdapterCache.json), whileAdaptedResourcesLookupTable.jsonis the general adapted-resource discovery cache documented bydsc resource list. Attributing this file to the PowerShell adapters sends readers to the wrong cache and troubleshooting location.
The adapter cache is the `AdaptedResourcesLookupTable.json` file that the
[Microsoft.DSC/PowerShell][06] and [Microsoft.Windows/WindowsPowerShell][07] adapters use to
speed up discovery. For more information, see [dsc resource list][08].
dsc/docs-conceptual/dsc-3.0/concepts/environment-variables.md:124
- The existing
Microsoft.DSC/Includereference says that relative paths supplied with configuration content resolve against the current working directory, but this section says--inputand stdin retain an inheritedDSC_CONFIG_ROOT. That produces different documented results for the same kind of invocation; reconcile the two references or explicitly document the exception in the Include guidance.
- When you pass the configuration document with the `--input` option or from stdin, DSC keeps the
existing value of `DSC_CONFIG_ROOT` if the variable is already defined. Otherwise, DSC sets the
variable to the current working directory.
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| - name: Show the user profile folder | ||
| type: Microsoft.DSC.Debug/Echo | ||
| properties: | ||
| output: "[envvar('USERPROFILE')]" |
| 1. The `tracing.level` value in the policy file, when the policy file defines the `tracing` | ||
| setting. When a policy is in use, DSC ignores the `--trace-level` option. | ||
| 1. The `--trace-level` command-line option. | ||
| 1. The `DSC_TRACE_LEVEL` environment variable, when `tracing.allowOverride` is `true`. | ||
| 1. The `tracing.level` value in the settings file. |
PR Summary
Adds a new conceptual document describing how environment variables are read and set, how they change resource discovery, and more.
Fixes #420
PR Checklist