Credentials in Desired State Configuration

Question:

I have the following Desired State Configuration (DSC)

}

When I try to execute this I get the following error:

ConvertTo-MOFInstance : System.InvalidOperationException error processing property ‘Credential’ OF TYPE ‘xPfxImport’:
Converting and storing encrypted passwords as plain text is not recommended. For more information on securing credentials in
MOF file, please refer to MSDN blog: http://go.microsoft.com/fwlink/?LinkId=393729
At C:\Users\x\Desktop\script.ps1:18 char:9
+ xPfxImport
At line:341 char:16
+ $aliasId = ConvertTo-MOFInstance $keywordName $canonicalizedValue
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Write-Error], InvalidOperationException
+ FullyQualifiedErrorId : FailToProcessProperty,ConvertTo-MOFInstance
Compilation errors occurred while processing configuration ‘Cert’. Please review the errors reported in error stream and
modify your configuration code appropriately.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:3917
char:5
+ throw $ErrorRecord
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Cert:String) [], InvalidOperationException
+ FullyQualifiedErrorId : FailToProcessConfiguration

I realize that the password must be encrypted and saving it as plain is not allowed or at least not recommended. I have tried many things suggested in the internet and I am still not able to make this working properly.

I am looking for a way to install a certificate and give certain set certificate permissions after that.

Answer:

You need to allow for plaintextcredentials (link)

Source:

Credentials in Desired State Configuration by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply