Search code examples
azurepowershelldscazure-rm-template

AdminCreds parameter not found in JSON DSC


I'm trying to add an extension to an azure arm template, so when it loops around it adds the extension to each vm, but I'm getting an error where it doesn't recognise the credentials parameter.

The full JSON is at the link below:

https://pastebin.com/embed_iframe/7uvwdZ6e

The error I'm getting is:

VM has reported a failure when processing extension 'CreateADPDC'. Error message: "The DSC Extension received an incorrect input: A parameter cannot be found that 
matches parameter name 'AdminCreds'.
Another common error is to specify parameters of type PSCredential without an explicit type. Please be sure to use a typed parameter in DSC Configuration, for example:
    configuration Example {
        param([PSCredential] $UserAccount)

Any idea where I've gone wrong on this?

Thanks in advance :)


Solution

  • this error comes from your configuration\arm template interaction, if you have the AdminCreds credentials parameter there, i think you need to use protectedsettings to pass it:

    "protectedSettings": {
        "configurationArguments": {
            "adminCreds": {
                "userName": "xxx",
                "password": "yyy"
            }
        }
    }
    

    configuration should look like this (so should contain adminCreds input parameter with that particular type):

    Param (
        [System.Management.Automation.PSCredential]$Admincreds,
        other_params
    )