| description | Reference for the 'min' DSC configuration document function |
|---|---|
| ms.date | 02/28/2025 |
| ms.topic | reference |
| title | min |
Returns the minimum value from an array of integers or a comma-separated list of integers.
min(<integerList>)The min function returns the minimum value from an array of integers or a comma-separated list of
integers.
This configuration returns the smallest number from a list of integers.
# min.example.1.dsc.config.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Echo minimum value
type: Microsoft.DSC.Debug/Echo
properties:
output: "[min(3, 2, 5, 1, 7)]"dsc config get --file min.example.1.dsc.config.yaml config getresults:
- name: Echo minimum value
type: Microsoft.DSC.Debug/Echo
result:
actualState:
output: 1
messages: []
hadErrors: falseThis configuration echoes the smallest number from an array of integers that is retrieved as a reference to another resource instance. It uses YAML's folded multiline syntax to make the function more readable.
# min.example.2.dsc.config.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Echo integer array
type: Microsoft.DSC.Debug/Echo
properties:
output:
- 3
- 2
- 5
- 1
- 7
- name: Echo minimum integer
type: Microsoft.DSC.Debug/Echo
properties:
output: >-
[min(
reference(
resourceId('Microsoft.DSC.Debug/Echo', 'Echo integer array')
).actualState.output
)]
dependsOn:
- "[resourceId('Microsoft.DSC.Debug/Echo', 'Echo integer array')]"dsc config get --file min.example.2.dsc.config.yamlresults:
- name: Echo integer array
type: Microsoft.DSC.Debug/Echo
result:
actualState:
output:
- 3
- 2
- 5
- 1
- 7
- name: Echo minimum integer
type: Microsoft.DSC.Debug/Echo
result:
actualState:
output: 1The min() function expects either a single array of integers or a comma-separated array of
integers. When you pass integers directly, separate each integer with a comma. When you pass an
array object, the function only takes a single array as an argument. You can use the
createArray() function to combine multiple arrays or an array and additional integers.
Type: [integer, array(integer)]
Required: true
MinimumCount: 1
MaximumCount: 18446744073709551615The min() function returns a single integer representing the smallest value in the input.
Type: integer