Invalid Parameter when trying to enhance a DSC resource

I’ve been doing mostly terraform for the last 18 months and now I need to modify a DSC resource(so, I’m rusty) and I’m facing a strange problem. To solve a problem I added a parameter to an existing DSC resource(part of the xWebsiteAdministration resource) but when I try to run it it doesn’t recognize the extra paramater as valid(It’s called from ansible, but it’s the same when trying it with invoke-dscresource)

"msg": "Unsupported parameters for ( module: WebsiteName. Supported parameters include: Path, PsDscRunAsCredential_username, Filter, module_version, PsDscRunAsCredential_password, resource_name, OverrideMode, DependsOn"
I added the paramter the usual way
[Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $WebsiteName`
Any tips on what I am missing? I looked at the rest of the code and didn't see any other place to define a parameter.

Did you add an extra parameter to an existing resource in xWebAdministration module and calling it from ansible ?

Yes, that’s what I did

  • added a parameter to xIisFeatureDelegation
  • modified a line in the resource to use that parameter
  • deployed the modified module to the test server
  • called it using ansible(fail)
  • called it locally using invoke-dscresource to see if it was ansible or the resource itself(still a fail, with same message that the new parameter is not a valid one for the resource)
EDIT: I made another reply with the code, but it seems to be stuck in moderation?. Should appear eventually.

Here is the full command and result:

PS H:\> Invoke-DscResource -name xIisFeatureDelegation -Method Set -ModuleName xWebAdministration -Property @{filter = '/system.webserver/security/authentication/windowsAuthentication'
>> OverrideMode='Allow'
>> Path = 'IIS:\Sites\'
>> WebsiteName = 'mywebsitename'}

Undefined property WebsiteName
At line:11, char:2

  • CategoryInfo : SyntaxError: (root/Microsoft/…gurationManager:String) [], CimException
  • FullyQualifiedErrorId : MiClientApiError_Failed
  • PSComputerName : localhost

and here is the parameter definition in the Set-TargetResource
        [Parameter(Mandatory = $true)]
        [Parameter(Mandatory = $true)]
        [ValidateSet('Allow', 'Deny')]
        [Parameter(Mandatory = $true)]
        [Parameter(Mandatory = $true)]