Welcome › Forums › DSC (Desired State Configuration) › Invalid Parameter when trying to enhance a DSC resource
- This topic has 4 replies, 2 voices, and was last updated 2 months ago by
Blocked.
-
AuthorPosts
-
-
November 25, 2020 at 7:50 am #274047
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 (ansible.windows.win_dsc) 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.
-
This topic was modified 2 months ago by
Syl.
-
This topic was modified 2 months ago by
-
November 26, 2020 at 12:32 am #274242
Did you add an extra parameter to an existing resource in xWebAdministration module and calling it from ansible ?
-
November 26, 2020 at 7:27 am #274338
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.
-
This reply was modified 2 months ago by
Syl. Reason: added notification about other reply
-
November 26, 2020 at 7:58 am #274350
Here is the full command and result:
PowerShell1234PS 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
Buffer:
irectResourceAccess”;
};^
insta
+ CategoryInfo : SyntaxError: (root/Microsoft/…gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MiClientApiError_Failed
+ PSComputerName : localhostand here is the parameter definition in the Set-TargetResource
PowerShell123456789101112131415161718192021[CmdletBinding()]param([Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][String]$Filter,[Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][ValidateSet('Allow', 'Deny')][String]$OverrideMode,[Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][String]$Path,[Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][String]$WebsiteName)
-
-
AuthorPosts
- You must be logged in to reply to this topic.