We have a powershell DSC that is being executed to bring a vmss to a desired state. It was working until we added some more parameters, and then it broke.
I removed everything except the parameters from the script and it still doesn't work. The full error is
The DSC Extension received an incorrect input: An error occurred while executing script or module 'IISInstall.ps1': An item with the same key has already been added..
Please correct the input and retry executing the extension.
We even added logging in the DSC to try to troubleshoot. It doesn't even seem to make it into the body of the DSC.
What am I doing wrong?
The parameter was called $instanceName. We wanted to use it to add a custom header to IIS to track which instance a response came from.
Turns out if you use $instanceName that steps on the internals of DSC in some way and it will never deploy correctly!
As soon as you remove $instanceName from the parameter list, it will work.