|
| 1 | +# DSC Configuration document parameter schema |
| 2 | + |
| 3 | +## Synopsis |
| 4 | + |
| 5 | +Defines runtime options for a configuration. |
| 6 | + |
| 7 | +## Metadata |
| 8 | + |
| 9 | +```yaml |
| 10 | +Schema Dialect : https://json-schema.org/draft/2020-12/schema |
| 11 | +Schema ID : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.parameter.json |
| 12 | +Type : object |
| 13 | +``` |
| 14 | +
|
| 15 | +## Description |
| 16 | +
|
| 17 | +DSC Configuration documents can include parameters, which users can override at runtime. Parameters |
| 18 | +enable separating secrets from configuration definitions and enable users to write configurations |
| 19 | +that can apply to multiple contexts. |
| 20 | +
|
| 21 | +Parameters are defined as key-value pairs in the `parameters` property of a configuration document. |
| 22 | +The key is the parameter's name, which is used to reference the parameter in the [resources][01] |
| 23 | +property of the configuration document. The value is an object that defines the parameter. |
| 24 | + |
| 25 | +Every parameter defines its data type. Parameters may also define a default value, validation |
| 26 | +checks, a description of their purpose, and arbitrary metadata. |
| 27 | + |
| 28 | +## Required Properties |
| 29 | + |
| 30 | +- [type](#type) |
| 31 | + |
| 32 | +## Properties |
| 33 | + |
| 34 | +### description |
| 35 | + |
| 36 | +Parameters may define a short explanation of their purpose and usage with the `description` |
| 37 | +property. To define a longer explanation in YAML, use the folded block syntax or literal block |
| 38 | +syntax. |
| 39 | + |
| 40 | +```yaml |
| 41 | +Type: string |
| 42 | +Required: false |
| 43 | +``` |
| 44 | + |
| 45 | +### metadata |
| 46 | + |
| 47 | +The `metadata` property defines a set of key-value pairs as annotations for the parameter. DSC |
| 48 | +doesn't validate the metadata. A parameter can include any arbitrary information in this property. |
| 49 | + |
| 50 | +```yaml |
| 51 | +Type: object |
| 52 | +Required: false |
| 53 | +``` |
| 54 | + |
| 55 | +### type |
| 56 | + |
| 57 | +Every parameter must define the data type that it expects as the `type` property. DSC validates the |
| 58 | +data type for every passed parameter before executing a configuration operation. |
| 59 | + |
| 60 | +The `secure*` data types indicate that DSC and integrating tools shouldn't log or record the |
| 61 | +values. If a secure data type parameter is used for a resource instance property that doesn't |
| 62 | +expect a secure value, the resource may still log or record the value. If the resource has |
| 63 | +independent logging or recording that isn't handled by DSC, the value may be stored insecurely. |
| 64 | + |
| 65 | +Use secure strings for passwords and secrets. |
| 66 | + |
| 67 | +For more information about data types, see |
| 68 | +[DSC configuration parameter data type schema reference][02]. |
| 69 | + |
| 70 | +```yaml |
| 71 | +Type: string |
| 72 | +Required: true |
| 73 | +Valid Values: |
| 74 | + - string |
| 75 | + - securestring |
| 76 | + - int |
| 77 | + - bool |
| 78 | + - object |
| 79 | + - secureobject |
| 80 | + - array |
| 81 | +``` |
| 82 | + |
| 83 | +### defaultValue |
| 84 | + |
| 85 | +Parameters may define a default value with the `defaultValue` property. If the parameter isn't |
| 86 | +passed at runtime, DSC uses the default value for the parameter. If the parameter isn't passed at |
| 87 | +runtime and no default value is defined, DSC raises an error. The value must be valid for the |
| 88 | +parameter's `type`. |
| 89 | + |
| 90 | +```yaml |
| 91 | +Required: false |
| 92 | +Valid JSON Types: |
| 93 | + - string |
| 94 | + - integer |
| 95 | + - object |
| 96 | + - array |
| 97 | + - boolean |
| 98 | +``` |
| 99 | + |
| 100 | +### allowedValues |
| 101 | + |
| 102 | +Parameters may limit the set of valid values for the parameter by defining the `allowedValues` |
| 103 | +property. DSC validates parameters passed at runtime and defined as `defaultValue` against this |
| 104 | +list of values. If any of the values is invalid, DSC raises an error. |
| 105 | + |
| 106 | +This property is always an array. If this property is defined, it must include at least one item in |
| 107 | +the list of values. |
| 108 | + |
| 109 | +```yaml |
| 110 | +Type: array |
| 111 | +Required: false |
| 112 | +Valid Item JSON Types: |
| 113 | + - string |
| 114 | + - integer |
| 115 | + - object |
| 116 | + - array |
| 117 | + - boolean |
| 118 | +``` |
| 119 | + |
| 120 | +### minLength |
| 121 | + |
| 122 | +The `minLength` property defines a validation option for array and string parameters. The length of |
| 123 | +a string is its character count. The length of an array is its item count. |
| 124 | + |
| 125 | +If the default value or runtime value for the parameter is shorter than this property, DSC raises |
| 126 | +an error. If this property is defined for parameters whose `type` isn't `array`, `string`, or |
| 127 | +`securestring`, DSC raises an error. |
| 128 | + |
| 129 | +If this property is defined with the `maxLength` property, this property must be less than |
| 130 | +`maxLength`. If it isn't, DSC raises an error. |
| 131 | + |
| 132 | +```yaml |
| 133 | +Type: int |
| 134 | +Required: false |
| 135 | +Minimum Value: 0 |
| 136 | +``` |
| 137 | + |
| 138 | +### maxLength |
| 139 | + |
| 140 | +The `maxLength` property defines a validation option for array and string parameters. The length of |
| 141 | +a string is its character count. The length of an array is its item count. |
| 142 | + |
| 143 | +If the default value or runtime value for the parameter is longer than this property, DSC raises an |
| 144 | +error. If this property is defined for parameters whose `type` isn't `array`, `string`, or |
| 145 | +`securestring`, DSC raises an error. |
| 146 | + |
| 147 | +If this property is defined with the `minLength` property, this property must be greater than |
| 148 | +`minLength`. If it isn't, DSC raises an error. |
| 149 | + |
| 150 | +```yaml |
| 151 | +Type: int |
| 152 | +Required: false |
| 153 | +Minimum Value: 0 |
| 154 | +``` |
| 155 | + |
| 156 | +### minValue |
| 157 | + |
| 158 | +The `minValue` property defines a validation option for integer parameters. If the default value or |
| 159 | +runtime value for the parameter is less than this property, DSC raises an error. If this property |
| 160 | +is defined for parameters whose `type` isn't `int`, DSC raises an error. |
| 161 | + |
| 162 | +If this property is defined with the `maxValue` property, this property must be less than |
| 163 | +`maxValue`. If it isn't, DSC raises an error. |
| 164 | + |
| 165 | +```yaml |
| 166 | +Type: int |
| 167 | +Required: false |
| 168 | +``` |
| 169 | + |
| 170 | +### maxValue |
| 171 | + |
| 172 | +The `maxValue` property defines a validation option for integer parameters. If the default value or |
| 173 | +runtime value for the parameter is greater than this property, DSC raises an error. If this |
| 174 | +property is defined for parameters whose `type` isn't `int`, DSC raises an error. |
| 175 | + |
| 176 | +If this property is defined with the `minValue` property, this property must be greater than |
| 177 | +`minValue`. If it isn't, DSC raises an error. |
| 178 | + |
| 179 | +```yaml |
| 180 | +Type: int |
| 181 | +Required: false |
| 182 | +``` |
| 183 | + |
| 184 | +[01]: resources.md |
| 185 | +[02]: ../definitions/parameters/dataTypes.md |
0 commit comments