# Documenting policies How to produce documentation from a script or a pipeline: the outputs, how to select what gets documented, every option, and what each output provider expects. The UI's Bulk > Document form drives exactly the same engine, so anything set there can be set from `-Options`. For the engine's internals - handlers, input providers, the customizer hooks and how to add a renderer for a new type - read the source under `Internal/Documentation/`. ## Contents - [The two commands](#the-two-commands) - [Outputs](#outputs) - [Selecting what to document](#selecting-what-to-document) - [Documenting from an export folder](#documenting-from-an-export-folder) - [Options](#options) - [Per-output options](#per-output-options) - [Where files land and how they are named](#where-files-land-and-how-they-are-named) - [Languages](#languages) - [Which types document, and how](#which-types-document-and-how) - [Pipeline examples](#pipeline-examples) ## The two commands | Command | Use when | |---|---| | `Start-IMGraphBulkDocumentation -OutputFormat ...` | You want files. Selects by type, group, object or export folder, runs every selected policy through the chosen outputs. | | `Get-IMGraphDocumentation -PolicyObject ` | You want the data. Returns one policy's documentation as an object - `BasicInfo`, `FilteredSettings`, `Assignments`, `Scripts`, `CustomTables` - to build your own report from. | Both take `-Language` and `-Options`. Full parameter tables are in [CommandReference.md](CommandReference.md#documentation). ## Outputs `-OutputFormat` names one or more providers, comma-separated. `Get-IMDocumentationOutput` lists them. | Value | Produces | Notes | |---|---|---| | `html` | one `.html`, or one per policy | Self-contained; the CSS is inlined. | | `md` | one `.md`, or one per policy | Optionally with the CSS inlined for renderers that honour it. | | `word` | one `.docx` | **Windows only** - needs Word installed (COM automation). Silently degrades elsewhere. | | `json` | one `.json`, or one per policy | The raw documentation objects - the same data `Get-IMGraphDocumentation` returns. | | `csv` | one `.csv` per policy type | Flat rows; good for spreadsheets and diffing. | | `atlassian` | one file, or one per policy, in Confluence storage format | Paste into a Confluence page, or push through the REST API. Headings carry stable anchors that downstream tooling can link to - see [DocumentationAtlassianOutput.md](DocumentationAtlassianOutput.md). | ```powershell Start-IMGraphBulkDocumentation -OutputFormat html -PolicyGroup Compliance Start-IMGraphBulkDocumentation -OutputFormat 'html,md,json' -PolicyGroup Compliance ``` ## Selecting what to document One parameter set per way of choosing: ```powershell # Every policy of one or more types Start-IMGraphBulkDocumentation -OutputFormat html -PolicyType CompliancePolicies, ConditionalAccess # Every type in one or more groups Start-IMGraphBulkDocumentation -OutputFormat html -PolicyGroup DeviceConfiguration, EndpointSecurity # Specific policies, from the pipeline Get-IMGraphPolicies -PolicyType SettingsCatalog -NameFilter 'Baseline' | Start-IMGraphBulkDocumentation -OutputFormat html # Everything in an export folder (see the next section) Start-IMGraphBulkDocumentation -OutputFormat html -SourceFolder C:\IntuneExport ``` Type and group ids are the ones in the README's policy table. Nothing is documented that the signed-in identity cannot read; a type it has no access to is skipped with a log line. ## Documenting from an export folder `-SourceFolder` documents the json files of an export instead of live policies. Two things to know: - **It still needs a signed-in tenant - but any tenant, not the source.** Setting definitions, templates and category names are generic Intune data and are looked up live from whatever tenant is connected. The policies themselves come from the files. - **Source-tenant names are not looked up.** The mode sets `SourceTenantUnavailable = $true`, which skips every lookup only the source tenant could answer: assignment group names, scope tag names, filter names, app names. Those are resolved from the export's migration table when the export was made with one, and shown as ids otherwise. This is the mode for documenting a tenant you no longer have access to, or for generating documentation in a pipeline from an export artifact rather than from a live sign-in with broad read rights. ## Options `-Options` is a hashtable. Anything not given falls back to the value saved by the UI's documentation form, then to the default below. All keys are optional. | Key | Default | Effect | |---|---|---| | `IncludeScripts` | `$true` | Include script bodies (PowerShell, shell, remediation) in the output. | | `ExcludeScriptSignature` | `$false` | Strip Authenticode signature blocks from included scripts. | | `IncludePolicyId` | `$false` | Add the policy's id to its basic information. | | `ExcludeAssignments` | `$false` | Leave assignments out. | | `SkipNotConfigured` | `$false` | Omit settings that are not configured. | | `SkipDefaultValues` | `$false` | Omit settings still at their default. | | `SkipDisabled` | `$true` | Omit settings that are disabled. | | `SetUnconfiguredValue` | `$true` | Render unconfigured settings with the text below instead of blank. | | `SetDefaultValue` | `$false` | Render settings at default with their default value. | | `NotConfiguredText` | `notConfigured` | Text for an unconfigured setting: `notConfigured` (the language string), `empty`, or `asis`. | | `ValueOutputProperty` | `value` | For ADMX settings: `value`, or `valueWithLabel` to include the setting's label. | | `PropertySeparator` | `;` | Separator between values of a multi-value property. | | `ObjectSeparator` | newline | Separator between items of a collection. | | `SkipDocumentInfo` | `$false` | Omit the "documented by / on" block. | | `FallbackDocumentation` | `$true` | Types with no dedicated renderer are documented as basic information plus one row per property. Off, they are skipped with a warning. (The UI calls this *Document unsupported types*.) | | `SourceTenantUnavailable` | `$false` | Set automatically by `-SourceFolder`; see above. The old name `OfflineDocumentation` still works. | | `Outputs` | `@{}` | Per-output options - next section. | ```powershell $o = @{ SkipNotConfigured = $true SkipDefaultValues = $true IncludePolicyId = $true ExcludeAssignments = $true } Start-IMGraphBulkDocumentation -OutputFormat html -PolicyGroup Compliance -Options $o ``` ## Per-output options Under `Outputs`, one hashtable per provider value. A key given here wins over the saved UI setting, which wins over the default. ```powershell $o = @{ Outputs = @{ html = @{ HTMLDocumentName = 'C:\Reports\Intune-%Date%.html'; HTMLDocumentFileType = 'Object' } md = @{ MDDocumentName = 'C:\Reports\Intune.md'; MDIncludeCSS = $false; MDDocumentSkipDate = $true } } } Start-IMGraphBulkDocumentation -OutputFormat 'html,md' -PolicyGroup Compliance -Options $o ``` ### `html` | Key | Default | Effect | |---|---|---| | `HTMLDocumentName` | `%MyDocuments%\%Organization%-%Date%.html` | Output file. Placeholders below. | | `HTMLDocumentFileType` | `Full` | `Full` - one file; `Object` - one file per policy, named after it, in the same folder. | | `HTMLTitleProperty` | `Intune documentation` | Page title. | | `HTMLCSSFile` | the shipped `DefaultHTMLStyle.css` | Your own stylesheet, inlined. | | `HTMLOpenFile` | `$true` | Open the result when done - set `$false` in a pipeline. | ### `md` | Key | Default | Effect | |---|---|---| | `MDDocumentName` | `%MyDocuments%\%Organization%-%Date%.md` | Output file. | | `MDDocumentFileType` | `Full` | `Full` or `Object`, as for html. | | `MDTitleProperty` | `Intune documentation` | Document title. | | `MDCSSFile` | the shipped `DefaultMDStyle.css` | Stylesheet for `MDIncludeCSS`. | | `MDIncludeCSS` | `$true` | Inline the CSS (renderers that honour `