I am trying to apply various custom Policies to Windows VMs on Azure. Most are unproblematic, however when trying to use the module SecurityPolicyDSC, specifically the AccountPolicy resource, I get the error (via guest assignments on azure):
The file could not be read: Index operation failed; the array index evaluated to null.. The PowerShell DSC resource '[AccountPolicy]AccountPolicies' with SourceInfo 'C:\Users\tjohnson\Documents\DSC\AccountPolicyExample.ps1::8::9::AccountPolicy' threw one or more non-terminating errors while running the Test-TargetResource functionality
The policy is currently being applied in audit only mode.
In an attempt to troubleshoot, I have ran it using the AccountPolicy example from the SecurityPolicy Github, expecting it to work fine. However, I ran into the same error.
It is possible that a SecurityPolicyDsc module file has corrupted on the VM that you are applying the policy to. Please try this: