1
votes

I'm using Powershell DSC to install chocolatey on a VM, setup through an Azure Automation Account. This is a snippet of my DSC configuration:

    cChocoInstaller installChoco 
    { 
        InstallDir = "C:\choco" 
    }

    xFirewall WebFirewallRule 
    { 
        Direction = "Inbound" 
        Name = "Web-Server-TCP-In" 
        DisplayName = "Allow http Inbound" 
        Description = "Allow incoming web site traffic." 
        Enabled = "true"
        Action = "Allow" 
        Protocol = "TCP" 
        LocalPort = "80" 
        Ensure = "Present" 
    }

On the first time the consistency check runs, it installs chocolatey and returns compliant, but every single check after that is marked as Non Compliant, because of installChoco. The firewall rule is compliant every time.

enter image description here

enter image description here

I'm new to powershell DSC - am I missing something? Do I need to install chocolatey in a different way for it to realise it's there on subsequent runs?

Thanks.

1
you should probably test on your own VM without azure automation, if this behavior is confirmed - you can file a bug on cchoco github page. Because their examples list the same stuff as you did github.com/PowerShellOrg/cChoco/blob/master/ExampleConfig.ps14c74356b41
Thanks - tried it locally and it says choco is installed, so it must be something odd about the reporting back to Azure...ssloan
For anyone else trying to test this stuff locally, found this as a useful guide for how to do it: blogs.technet.microsoft.com/paulomarques/2016/07/06/…ssloan
well, in that case you'd probably want to file a bug on azure automation and cchoco :)4c74356b41
Here's a link over to this SO post from the cChoco one - github.com/PowerShellOrg/cChoco/issues/57ferventcoder

1 Answers

0
votes

What version of the chocolatey DSC resource are you using? there was an issue in an earlier version of the chocolatey DSC resource (before ~July 2016) where the test was returning false when it should have returned true.

https://github.com/PowerShellOrg/cChoco/pull/33 is the PR it was fixed in.