Skip to content

Add reference documentation for Microsoft.DSC.Debug/Echo #902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 30, 2025
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
description: Demonstrates basic usage of the Microsoft.DSC.Debug/Echo resource
ms.date: 06/22/2025
ms.topic: reference
title: Basic echo example
---

This example demonstrates how to use the `Microsoft.DSC.Debug/Echo` to test the output returned by DSC.

## Test the output returned by DSC

The following snippet shows how you can use the resource with the [dsc resource test][01] command to test if the
system is in the desired state.

```powershell
$instance = @{
output = 'Hello World!'
} | ConvertTo-Json

dsc resource test --resource Microsoft.DSC.Debug/Echo --input $instance
```

```yaml
desiredState:
output: Hello World!
actualState:
output: Hello World!
inDesiredState: true
differingProperties: []
```

> [!NOTE]
> The `Microsoft.DSC.Debug/Echo` resource always returns `inDesiredState: true` because it's a
> test resource designed to echo back values.
> It doesn't actually check or enforce anything on the system - it simply returns whatever value you
> provide as output.

## Using the get capability

The `Microsoft.DSC.Debug/Echo` resource's `get` capability returns the current value in the output property:

```powershell
$instance = @{
output = 'Hello World!'
} | ConvertTo-Json

dsc resource get --resource Microsoft.DSC.Debug/Echo --input $instance
```

The resource will return the same output value:

```yaml
actualState:
output: Hello World!
```

## Using the set capability

The `Microsoft.DSC.Debug/Echo` resource's `set` capability simply accepts a value and echoes
it back without modifying anything:

```powershell
$instance = @{
output = @{
name = "ExampleSetting"
value = 123
enabled = $true
}
} | ConvertTo-Json

dsc resource set --resource Microsoft.DSC.Debug/Echo --input $instance
```

This will report success and echo the complex object:

```yaml
beforeState:
output:
value: 123
enabled: true
name: ExampleSetting
afterState:
output:
value: 123
enabled: true
name: ExampleSetting
changedProperties: []
```

> [!NOTE]
> Even though you're using the `set` capability, no actual changes are made to the system.

## See also

- [Microsoft.DSC.Debug/Echo resource](../index.md)

<!-- Link reference definitions -->
[01]: ../../../../../cli/resource/test.md
167 changes: 167 additions & 0 deletions docs/reference/resources/Microsoft/DSC/Debug/echo/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
---
description: Microsoft.DSC.Debug/Echo resource reference documentation
ms.date: 06/22/2025
ms.topic: reference
title: Microsoft.DSC.Debug/Echo
---

# Microsoft.DSC.Debug/Echo

## Synopsis

A debug resource for testing and troubleshooting Microsoft DSC (Desired State Configuration) behavior.

## Metadata

```yaml
Version : 1.0.0
Kind : resource
Tags : [Windows, MacOS, Linux]
Author : Microsoft
```

## Instance definition syntax

```yaml
resources:
- name: <instance name>
type: Microsoft.DSC.Debug/Echo
properties:
# Required properties
output: anyOf # array, boolean, integer, object, string
```

## Description

The `Microsoft.DSC.Debug/Echo` resource is a debugging utility that echoes back the configuration
data passed to it. This resource is particularly useful for:

- Testing DSC configuration syntax and structure.
- Debugging parameter passing between resources.
- Verifying that DSC is processing configurations as expected.
- Understanding how DSC transforms and handles configuration data.

> [!NOTE]
> This resource is installed with DSC itself on any systems.
>
> You can update this resource by updating DSC. When you update DSC, the updated version of this
> resource is automatically available.

## Capabilities

The resource has the following capabilities:

- `get` - You can use the resource to retrieve the actual state of an instance.
- `set` - You can use the resource to enforce the desired state for an instance.
- `test` - You can use the resource to check if the actual state matches the desired state
for an instance.

For more information about resource capabilities, see
[DSC resource capabilities][01].

> [!NOTE]
> Invoking any operation on this resource doesn't affect the system.
> This resource only echoes the value in the output.

## Examples

1. [Basic echo example](./examples/basic-echo-example.md) - Shows how to use the Echo resource
for basic string and complex data output.

## Properties

The following list describes the properties for the resource.

- **Required properties:** <a id="required-properties"></a> The following property is always
required when defining an instance of the resource. An instance that doesn't define this
property is invalid. For more information, see the "Required resource properties" section in
[DSC resource properties][02]

- [output](#output) - The value to be echoed back by the resource.

- **Key properties:** <a id="key-properties"></a> The following property uniquely identifies an
instance. If two instances of a resource have the same value for this property, the instances are
conflicting. For more information about key properties, see the "Key resource properties" section in [DSC resource properties][03].

- [output](#output) (required) - The value to be echoed back by the resource.

### output

<details><summary>Expand for <code>output</code> property metadata</summary>

```yaml
Type : anyOf (array, boolean, integer, object, string)
IsRequired : true
IsKey : true
IsReadOnly : false
IsWriteOnly : false
```

</details>

Defines the value to be echoed back by the resource. The `output` property can be any of the following types:

| Type | Description |
|:-------:|:---------------------------------------------|
| array | An array of values. |
| boolean | A boolean value (`true` or `false`). |
| integer | An integer value. |
| object | A JSON object of key-value pairs. |
| string | A string value. |

## Instance validating schema

The following snippet contains the JSON Schema that validates an instance of the resource. The
validating schema only includes schema keywords that affect how the instance is validated. All
non validating keywords are omitted.

```json
{
"type": "object",
"required": [
"output"
],
"properties": {
"output": {
"$ref": "#/definitions/Output"
}
},
"additionalProperties": false,
"definitions": {
"Output": {
"anyOf": [
{
"type": "array",
"items": true
},
{
"type": "boolean"
},
{
"type": "integer",
"format": "int64"
},
true,
true,
{
"type": "object"
},
{
"type": "string"
}
]
}
}
}
```

## See also

- [Microsoft/OSInfo resource][04]
- [DSC resource capabilities][01]

<!-- Link definitions -->
[01]: ../../../../../concepts/resources/capabilities.md
[02]: ../../../../../concepts/resources/properties.md#required-resource-properties
[03]: ../../../../../concepts/resources/properties.md#key-resource-properties
[04]: ../../osinfo/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ operation without the `--what-if` flag.

The following snippet contains the JSON Schema that validates an instance of the resource. The
validating schema only includes schema keywords that affect how the instance is validated. All
nonvalidating keywords are omitted.
non validating keywords are omitted.

```json
{
Expand Down