UseIdenticalParametersForDSC
Severity Level: Error
Description
The Get-TargetResource
, Test-TargetResource
and Set-TargetResource
functions of DSC Resource
must have the same parameters.
How
Correct the parameters for the functions in DSC resource.
Example
Wrong
function Get-TargetResource
{
[OutputType([Hashtable])]
param
(
[parameter(Mandatory = $true)]
[String]
$Name,
[String]
$TargetResource
)
...
}
function Set-TargetResource
{
param
(
[parameter(Mandatory = $true)]
[String]
$Name
)
...
}
function Test-TargetResource
{
[OutputType([System.Boolean])]
param
(
[parameter(Mandatory = $true)]
[String]
$Name
)
...
}
Correct
function Get-TargetResource
{
[OutputType([Hashtable])]
param
(
[parameter(Mandatory = $true)]
[String]
$Name,
[String]
$TargetResource
)
...
}
function Set-TargetResource
{
param
(
[parameter(Mandatory = $true)]
[String]
$Name,
[String]
$TargetResource
)
...
}
function Test-TargetResource
{
[OutputType([System.Boolean])]
param
(
[parameter(Mandatory = $true)]
[String]
$Name,
[String]
$TargetResource
)
...
}
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for