@@ -14,9 +14,9 @@ Defines a DSC Resource instance in a configuration document.
1414## Metadata
1515
1616``` yaml
17- Schema Dialect : https://json-schema.org/draft/2020-12/schema
18- Schema ID : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.resource.json
19- Type : object
17+ SchemaDialect : https://json-schema.org/draft/2020-12/schema
18+ SchemaID : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.resource.json
19+ Type : object
2020` ` `
2121
2222## Description
@@ -45,9 +45,13 @@ The `name` property of a resource instance defines the short, human-readable nam
4545Resource instance. This property must be unique within a DSC Configuration document. If any
4646resource instances share the same name, DSC raises an error.
4747
48+ The instance name must be a non-empty string containing only letters, numbers, and spaces.
49+
4850` ` ` yaml
49- Type: string
50- Required: true
51+ Type: string
52+ Required: true
53+ MinimumLength: 1
54+ Pattern: ^[a-zA-Z0-9 ]+$
5155` ` `
5256
5357# ## type
@@ -80,30 +84,62 @@ Required: true
8084To declare that a resource instance is dependent on another instance in the configuration, define
8185the `dependsOn` property.
8286
83- This property must be an array of dependency declarations. Each dependency must use this
84- syntax :
87+ This property defines a list of DSC Resource instances that DSC must successfully process before
88+ processing this instance. Each value for this property must be the `resourceID()` lookup for
89+ another instance in the configuration. Multiple instances can depend on the same instance, but
90+ every dependency for an instance must be unique in that instance's `dependsOn` property.
91+
92+ The `resourceID()` function uses this syntax :
8593
8694` ` ` yaml
87- "[<resource-type-name>] <instance-name>"
95+ "[resourceId(' <resource-type-name>', ' <instance-name>'] "
8896` ` `
8997
90- In the dependency syntax, `<resource-type-name>` is the `type` property of the dependent resource
91- and `<instance-name>` is the dependency's `name` property.
98+ The `<resource-type-name>` value is the `type` property of the dependent resource and
99+ ` <instance-name>` is the dependency's `name` property. When adding a dependency in a YAML-format
100+ configuration document, always wrap the `resourceID()` lookup in double quotes (`"`).
101+
102+ For example, this instance depends on an instance of the `Microsoft.Windows/Registry`
103+ resource named `Tailspin Key` :
104+
105+ ` ` ` yaml
106+ - name: Tailspin Key
107+ type: Microsoft.Windows/Registry
108+ properties:
109+ keyPath: HKCU\t ailspin
110+ _ensure: Present
111+ - name: Update Tailspin Automatically
112+ type: Microsoft.Windows/Registry
113+ properties:
114+ keyPath: HKCU\t ailspin\updat es
115+ valueName: automatic
116+ valueData:
117+ String: enable
118+ dependsOn:
119+ - "[resourceId('Microsoft.Windows/Registry', 'Tailspin Key')]"
120+ ` ` `
92121
93- Multiple instances can depend on the same instance, but every dependency for an instance must be
94- unique in that instance's `dependsOn` property.
122+ > [!NOTE]
123+ > When defining dependencies for [nested resource instances][02], instances can only reference
124+ > dependencies in the same resource provider or group instance. They can't use the `resourceId()`
125+ > function to lookup instances at the top-level of the configuration document or inside another
126+ > provider or group instance.
127+ >
128+ > If a top-level instance depends on a nested instance, use the `resourceId()` function to lookup
129+ > the instance of the provider or group containing the dependency instance instead.
95130
96131<!-- For more information, see [Configuration resource dependencies][04]. -->
97132
98133` ` ` yaml
99- Type: array
100- Required: false
101- Items Must be Unique : true
102- Valid Items Type: string
103- Valid Items Pattern: ^\[\ w +(\.\w +){0,2}\/ \w +\] .+ $
134+ Type: array
135+ Required: false
136+ ItemsMustBeUnique : true
137+ ItemsType: string
138+ ItemsPattern: ^\[ resourceId \(\s *' \ w +(\.\w +){0,2}\/ \w +' \s *, \s *'[a-zA-Z0-9 ]+' \s * \)\] $
104139` ` `
105140
106141[01] : ../definitions/resourceType.md
142+ [02] : /powershell/dsc/glossary#nested-resource-instance
107143<!-- [02] : ../../../resources/concepts/assertion-resources.md -->
108144<!-- [03] : ../../../resources/concepts/schemas.md -->
109145<!-- [04] : ../../../configurations/concepts/dependencies.md -->
0 commit comments