-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AADAdministrativeUnit: Cannot leave 'Ensure' as default #4437
Comments
@andikrueger @ykuijs @salbeck-sit Can you help here please, again. As you know I've been trying to use this resource on many occasions and each time I do something new, basic bugs just keep on coming (#2633, #2704, #2775, #2776, #3194). I am again wondering whether your unit and integration tests are anywhere near appropriate. I tried this fix this myself and as far as I can tell Get-TargetResource is returning 'Ensure = Absent' if Absent is left blank, regardless of whether or not the AU exists. But:
If someone can untangle this mess, I'd appreciate it. At present I hate touching Microsoft365DSC, it never, ever 'just works'. |
Oh and I should have said - currently if you run Start-DscConfiguration on the test resource in this bug, you end up with multiple AdministrativeUnits created. So basically, for this resource, if Ensure is left blank, idempotency is broken. |
Ah, just figured something out. The whole of Get-TargetResource is basically one huge try {} catch (from line 101 to 273). When attempting to create an AADAdministrativeUnit from scratch without an ID, this always fails on line 108, and bumps down to line 275, returning an error. I'm not sure how to fix this - help? |
@Borgquite I think the issue with leaving Ensure blank is that it then isn't part of $PSBoundParameters. See https://ss64.com/ps/psboundparameters.html |
@Borgquite since I spent time to identify the problem it was almost a sin not to do a PR ;-) |
AADAdministrativeUnit - fixes #4437
Description of the issue
When creating an AADAdministrativeUnit resource, if the 'Ensure' field is not set, the resource is created correctly, but running Test-DscConfiguration afterwards still return 'False'. This also means that multiple runs of Start-DscConfiguration result in many AADAdministrativeUnits being created - in other words, it's not idempotent.
The apparent intention for the resource is that 'Ensure' defaults to 'Present'.
Setting Ensure = 'Present' manually resolves the issue but would rather this was not necessary.
Microsoft 365 DSC Version
1.24.228.1
Which workloads are affected
Azure Active Directory
The DSC configuration
Verbose logs showing the problem
Environment Information + PowerShell Version
The text was updated successfully, but these errors were encountered: