Credentials in Desired State Configuration


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:
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
+ 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.


You need to allow for plaintextcredentials (link)


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

Leave a Reply