|
| 1 | +# Command-based DSC Resource manifest schema reference |
| 2 | + |
| 3 | +To be recognized by DSC, every command-based DSC Resource must have a DSC Resource manifest. The manifest must: |
| 4 | + |
| 5 | +1. Be discoverable in the `PATH` environment variable. |
| 6 | +1. Follow the naming convention `<name>.resource.json`. |
| 7 | +1. Be valid for the schema described in this document. |
| 8 | + |
| 9 | +The rest of this document describes the DSC Resource manifest schema. |
| 10 | + |
| 11 | +## Metadata |
| 12 | + |
| 13 | +| Metadata Key | Metadata Value | |
| 14 | +|:------------:|:----------------------------------------------------| |
| 15 | +| `$schema` | `https://json-schema.org/draft/2020-12/schema` | |
| 16 | +| `$id` | `https://aka.ms/dsc/schemas/resource/manifest.yaml` | |
| 17 | +| `type` | `object` | |
| 18 | + |
| 19 | +## Required Properties |
| 20 | + |
| 21 | +The manifest must include these properties: |
| 22 | + |
| 23 | +- [manifestVersion](#manifestversion) |
| 24 | +- [type](#type) |
| 25 | +- [version](#version) |
| 26 | +- [get](#get) |
| 27 | + |
| 28 | +## Properties |
| 29 | + |
| 30 | +### manifestVersion |
| 31 | + |
| 32 | +The value of this property must be the semantic version (semver) of the DSC Resource manifest |
| 33 | +schema that the DSC Resource manifest validates against. |
| 34 | + |
| 35 | +```yaml |
| 36 | +Type: string |
| 37 | +Required: true |
| 38 | +Valid Values: |
| 39 | + - '1.0' |
| 40 | +``` |
| 41 | +
|
| 42 | +### type |
| 43 | +
|
| 44 | +The value of this property must be the name of the DSC Resource in its namespace. This value must |
| 45 | +use the following syntax: |
| 46 | +
|
| 47 | +```text |
| 48 | +`<owner>[.<group>][.<area>]/<name>` |
| 49 | +``` |
| 50 | + |
| 51 | +Each component must be string of alphanumeric characters and underscores. No other characters are |
| 52 | +permitted. Every DSC Resource must define an `owner` and a `name`. Use the `group` and `area` |
| 53 | +components to organize DSC Resources into related namespaces. For example: |
| 54 | + |
| 55 | +- `Microsoft.SqlServer/Database` |
| 56 | +- `Microsoft.SqlServer.Database/Role` |
| 57 | +- `Microsoft.SqlServer.Database/User` |
| 58 | +- `Microsoft.SqlServer/Endpoint` |
| 59 | +- `Microsoft.SqlServer.Endpoint/Permission` |
| 60 | +- `Microsoft.SqlServer/Login` |
| 61 | +- `Microsoft.SqlServer/MaxDop` |
| 62 | + |
| 63 | +```yaml |
| 64 | +Type: string |
| 65 | +Required: true |
| 66 | +Pattern: ^\w+(\.\w+){0,2}\/\w+$ |
| 67 | +``` |
| 68 | +
|
| 69 | +### version |
| 70 | +
|
| 71 | +The value of this property must be the current version of the DSC Resource as a valid semantic |
| 72 | +version string. The version applies to the DSC Resource, not the software it manages. |
| 73 | +
|
| 74 | +```yaml |
| 75 | +Type: string |
| 76 | +Required: true |
| 77 | +``` |
| 78 | +
|
| 79 | +### get |
| 80 | +
|
| 81 | +This property defines how to call the DSC Resource to get the current state of an instance. |
| 82 | +
|
| 83 | +The `executable` property, defining the name of the command to call, is mandatory. The `args` and |
| 84 | +`input` properties are optional. For more information, see the |
| 85 | +[Get method's schema documentation][01]. |
| 86 | + |
| 87 | +```yaml |
| 88 | +Type: object |
| 89 | +Required: true |
| 90 | +``` |
| 91 | + |
| 92 | +### set |
| 93 | + |
| 94 | +This property defines how to call the DSC Resource to set the desired state of an instance. It also |
| 95 | +defines how to process the output from the DSC Resource for this method. |
| 96 | + |
| 97 | +The `executable` property, defining the name of the command to call, is mandatory. The `args` |
| 98 | +`input`, `preTest`, and `returns` properties are optional. For more information, see the |
| 99 | +[Set method's schema documentation][02]. |
| 100 | + |
| 101 | +### test |
| 102 | + |
| 103 | +This property defines how to call the DSC Resource to test whether an instance is in the desired |
| 104 | +state. It also defines how to process the output from the DSC Resource for this method. |
| 105 | + |
| 106 | +The `executable` property, defining the name of the command to call, is mandatory. The `args` |
| 107 | +`input`, and `returns` properties are optional. For more information, see the |
| 108 | +[Test method's schema documentation][03]. |
| 109 | + |
| 110 | +### validate |
| 111 | + |
| 112 | +This property defines how to call the DSC Resource to validate an instance. |
| 113 | + |
| 114 | +The `executable` property, defining the name of the command to call, is mandatory. The `args` |
| 115 | +property is optional. For more information, see the [Validate method's schema documentation][04]. |
| 116 | + |
| 117 | +### provider |
| 118 | + |
| 119 | +When specified, this property defines the DSC Resource as a DSC Resource Provider. |
| 120 | + |
| 121 | +For more information, see the [DSC Resource manifest provider property schema reference][05]. |
| 122 | + |
| 123 | +### exitCodes |
| 124 | + |
| 125 | +This property defines a set of valid exit codes for the DSC Resource and their meaning. Define this |
| 126 | +property as a set of key-value pairs where: |
| 127 | + |
| 128 | +- The key is an integer that maps to a known exit code for the DSC Resource. |
| 129 | +- The value is a string describing the semantic meaning of that exit code for a human reader. |
| 130 | + |
| 131 | +DSC always interprets exit code `0` as a successful operation and any other exit code as an error. |
| 132 | + |
| 133 | +```yaml |
| 134 | +Type: object |
| 135 | +Required: false |
| 136 | +Valid Properties: |
| 137 | + Name Pattern: ^[0-9]+# |
| 138 | + Value Type: string |
| 139 | +``` |
| 140 | + |
| 141 | +### schema |
| 142 | + |
| 143 | +This property defines how DSC should get the JSON schema to validate an instance of the DSC |
| 144 | +Resource. This property must always be an object that defines one of the following properties: |
| 145 | + |
| 146 | +- `command` - When you specify the `command` property, DSC calls the defined command to get the |
| 147 | + JSON schema. |
| 148 | +- `embedded` - When you specify the `embedded` property, DSC uses the defined value as the JSON |
| 149 | + schema. |
| 150 | +- `url` - When you specify the `url` property, DSC fetches the JSON schema from the defined URL. |
| 151 | + |
| 152 | +For more information, see the [DSC Resource manifest schema property reference][06]. |
| 153 | + |
| 154 | +```yaml |
| 155 | +Type: object |
| 156 | +Required: true |
| 157 | +``` |
| 158 | + |
| 159 | +[01]: ./get.md |
| 160 | +[02]: ./set.md |
| 161 | +[03]: ./test.md |
| 162 | +[04]: ./validate.md |
| 163 | +[05]: ./provider.md |
| 164 | +[06]: ./manifest-schema.md |
0 commit comments