Custom DSC Resource Error


I created my own MSMQ DSC Resource to modify creation and permissions of each MSMQ queue. However, upon executing the DSC Configuration to generate the .mof files I receive an error stating:

Test-ConflictingResources : A conflict was detected between resources ‘[cMSMQACL]Test1 (::823::13::cMSMQACL)’ and ‘[cMSMQACL]Test2 (::839::13::cMSMQACL)’ in node
‘NodeName’. Resources have identical key properties but there are differences in the following non-key properties: ‘Permissions;ServiceAccount’. Values
‘FullControl;test\User1’ don’t match values ‘System.Object[];Test\User2’. Please update these property values so that they are identical in both cases.
At line:271 char:9

  •     Test-ConflictingResources $keywordName $canonicalizedValue $k ...
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:slight_smile: [Write-Error], InvalidOperationException
    • FullyQualifiedErrorId : ConflictingDuplicateResource,Test-ConflictingResources
      Errors occurred while processing configuration ‘CorpSysDSCConfiguration’.
      At C:\windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:3705 char:5
  • throw $ErrorRecord
  • ~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (CorpSysDSCConfiguration:String) [], InvalidOperationException
    • FullyQualifiedErrorId : FailToProcessConfiguration"

The Resources look like this:

                QueueName = "TestQueue"
                AccessRights = 'Allow'
                Permissions = 'FullControl'
               ServiceAccount = "Test\User1"

                QueueName = "TestQueue"
                AccessRights = 'Allow'
                Permissions = 'GetProperties','SetProperties'
                ServiceAccount = "Test\User2"

If I match the Permissions between the 2 then I receive the similar error but it then complains that the ServiceAccount entries do not match each other.
If I match both cMsmqACL resources then I can generate the.mof, but I do want to do that. I want to be able to setup permissions for each account even if they are identical or not.

Why would DSC complain about the permissions not being identical and is there something I have done incorrectly?

Every resource defines one or more properties as its “key.” I’m guessing you defined QueueName. Within a single configuration, you can only have ONE setting that has a given value for its key. So, in your case, if QueueName is the key, you have two different things happening for TestQueue. That’s not legal.

I get what you’re trying to do, but you either need to do it in a single setting block - perhaps passing an array of users and permissions or something - or you need to refactor your resource somehow.

Hey Don,

(Revised Response)
Yes. I did set the QueueName as the “Key”.

I thought if I tried the proposed solution below it would work - Long story short, it did not. I am running into the same issue which makes sense. The Ensure parameter is still identical so I receive the same error.
Proposed: “I update the resource to contain Ensure {Present | Absent} and set that as the “Key” and update the Queuename to “Write” would that allow me to use my DSC resources as I intended it?”

I looks like I will have to refactor my code to take in Account and Permissions or just start from scratch which I am thinking the latter is a better option.

Thanks for the info!