Using dynamic parameters in a DSC resource
I just tried to use dynamic parameters in a DSC resource. Unfortunately during testing, DSC prompted me with the following message:
"The command Test-TargetResource of the PS module MSFTx<RESOURCENAME> does not implement the write property ApplicationPool mentioned in the corresponding MOF schema file C:\Program Files\WindowsPowerShell\Modules<RESOURCENAME>\0.9.0.0\Ds
cResources\MSFTxSPWordAutomationServiceApp\MSFT_<RESOURCENAME>.schema.mof. All write paramenters mentioned in the schema file must be implemented by the command Test-TargetResource."
So it looks like Dynamic Parameters isn't supported in DSC resource, which is too bad. This forces me to add additional checks in my code.
Can you please add this support to DSC?
Can you explain a bit more why dynamic property support in needed for DSC resources
Yorick Kuijs commented
I am writing a resource that is to provision a component in SharePoint. One of the properties is Ensure, which can have a value of Present or Absent.
In case of Ensure=Present, the user has to specify several other properties which are required to configure the component. However when Ensure=Absent, I don't want them to specify these parameters. That is where I tried to use Dynamic parameters.
Unfortunately I am unable to do so, since DSC didn't support Dynamic parameters. So instead I had to include checks in my code to make sure some parameters aren't used together, basically mimicking the Dynamic parameter functionality.