| description | Reference for the 'join' DSC configuration document function |
|---|---|
| ms.date | 08/29/2025 |
| ms.topic | reference |
| title | join |
Joins an array into a single string, separated using a delimiter.
join(inputArray, delimiter)The join() function takes an array and a delimiter.
- Each array element is converted to a string and concatenated with the delimiter between elements.
The delimiter can be any value; it’s converted to a string.
Create a comma-separated string from a list of host names to pass to tools or
APIs that accept CSV input. This example uses [createArray()][02] to build
the server list and joins with ", ".
# join.example.1.dsc.config.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: "[join(createArray('web01','web02','web03'), ', ')]"dsc config get --file join.example.1.dsc.config.yamlresults:
- name: Echo
type: Microsoft.DSC.Debug/Echo
result:
actualState:
output: web01, web02, web03
messages: []
hadErrors: falseJoin path segments into a single path string. This is useful when composing paths dynamically from parts.
# join.example.2.dsc.config.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: "[join(createArray('/etc','nginx','sites-enabled'), '/')]"dsc config get --file join.example.2.dsc.config.yamlresults:
- name: Echo
type: Microsoft.DSC.Debug/Echo
result:
actualState:
output: /etc/nginx/sites-enabled
messages: []
hadErrors: falseConvert version components (numbers) into a dotted version string. Non-string elements are converted to strings automatically.
# join.example.3.dsc.config.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Echo
type: Microsoft.DSC.Debug/Echo
properties:
output: "[join(createArray(1,2,3), '.')]"dsc config get --file join.example.3.dsc.config.yamlresults:
- name: Echo
type: Microsoft.DSC.Debug/Echo
result:
actualState:
output: 1.2.3
messages: []
hadErrors: falseThe array whose elements will be concatenated.
Type: array
Required: true
Position: 1Any value used between elements. Converted to a string.
Type: any
Required: true
Position: 2Returns a string containing the joined result.
Type: string