Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 66 additions & 32 deletions docs/reference/schemas/extension/manifest/discover.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
description: JSON schema reference for the 'discover' property in a DSC extension manifest
ms.date: 02/28/2025
ms.date: 09/01/2026
ms.topic: reference
title: DSC extension manifest discover property schema reference
---
Expand All @@ -21,16 +21,39 @@ Type: object

## Description

A DSC extension that can enumerate DSC resource not discoverable in the `PATH` or `DSC_RESOURCE_PATH` environment variables
should define the `export` property in its manifest. This property defines how DSC can get the
path to otherwise undiscoverable manifests.
A DSC extension that can enumerate DSC resources not discoverable in the `PATH` or
`DSC_RESOURCE_PATH` environment variables should define the `discover` property in its manifest.
This property defines how DSC can get the path to, or the content of, otherwise undiscoverable
manifests. When the manifest defines this property, the extension has the `discover` capability.

When the DSC performs discovery for any operation, it calls the command defined by this property.
The extension must return the path to discovered manifests as [JSON lines][05]. Each JSON Line
should be an object representing the instance and validate against the
[DSC extension discover operation stdout schema reference][06].
When DSC performs discovery for any operation, it calls the command defined by this property with
the folder containing the extension manifest as the working directory. The extension must return
the discovered manifests as [JSON Lines][01]. Each JSON Line must be an object that validates
against the [DSC extension discover operation stdout schema reference][02].

## Required Properties
## Examples

The following example shows the `discover` property from the manifest for the
`Microsoft.PowerShell/Discover` extension. It runs a PowerShell script and passes the list of
manifest file extensions that DSC recognizes to the script's `-extensions` parameter as a quoted
string.

```yaml
discover:
executable: pwsh
args:
- -NoLogo
- -NonInteractive
- -ExecutionPolicy
- Bypass
- -NoProfile
- -Command
- ./powershell.discover.ps1
- extensionsArg: -extensions
includeQuotes: true
```

## Required properties

The `discover` definition must include these properties:

Expand All @@ -52,18 +75,15 @@ Required: true

### args

The `args` property defines the list of arguments to pass to the command. The arguments can be any
number of strings. If you want to pass the JSON object representing the property bag for the
extension input to an argument, you can define a single item in the array as a
[JSON object](#json-input-argument), indicating the name of the argument with the `jsonInputArg`
string property and whether the argument is mandatory for the command with the `mandatory` boolean
property.
The `args` property defines the list of arguments to pass to the command. Each item in the array
can be a string representing a static argument or an
[extensions argument](#extensions-argument) object that receives the list of file extensions DSC
recognizes for manifests.

Comment on lines 76 to 82
```yaml
Type: array
Required: false
Default: []
Type: [string, object(JSON Input Argument)]
Type: array
Required: false
ItemsType: [string, object(Extensions argument)]
```

#### String arguments
Expand All @@ -75,23 +95,37 @@ command, like `discover` or `--format`.
Type: string
```

#### JSON input argument
#### Extensions argument

Defines an argument that receives the list of file extensions DSC recognizes for manifests. Use
this argument so the extension can find manifests by file name without hard-coding the naming
conventions. This argument type was added in DSC version 3.3.0.

DSC passes the value of `extensionsArg` to the command, followed by a single argument containing
the comma-separated list of recognized file extensions:

- `.dsc.adaptedresource.json`, `.dsc.adaptedresource.yaml`, and `.dsc.adaptedresource.yml`
- `.dsc.extension.json`, `.dsc.extension.yaml`, and `.dsc.extension.yml`
- `.dsc.manifests.json`, `.dsc.manifests.yaml`, and `.dsc.manifests.yml`
- `.dsc.resource.json`, `.dsc.resource.yaml`, and `.dsc.resource.yml`

Defines an argument for the command that accepts the JSON input object as a string. DSC passes the
JSON input to the named argument when available. A JSON input argument is defined as a JSON object
with the following properties:
An extensions argument is defined as a JSON object with the following properties:

- `jsonInputArg` (required) - the argument to pass the JSON data to for the command, like `--input`.
- `mandatory` (optional) - Indicate whether DSC should always pass the argument to the command,
even when there's no JSON input for the command. In that case, DSC passes an empty string to the
JSON input argument.
- `extensionsArg` (required) - The argument to pass before the list of file extensions, like
`--extensions`.
- `includeQuotes` (optional) - Indicates whether DSC should wrap the list of file extensions in
double quotes. The default is `false`.

You can only define one JSON input argument per arguments array.
> [!NOTE]
> In DSC 3.2.x, the `args` array for the `discover` property accepted the same JSON input argument
> object (`jsonInputArg`) as the `get.args` property in resource manifests. Starting with DSC
> 3.3.0, that form isn't valid for the `discover` property.

```yaml
Type: object
RequiredProperties: [jsonInputArg]
Type: object
RequiredProperties: [extensionsArg]
```

[05]: https://jsonlines.org/
[06]: ../stdout/discover.md
<!-- Link reference definitions -->
[01]: https://jsonlines.org/
[02]: ../stdout/discover.md
Loading