EXODistributionGroup: Use retrieved Identity to update and delete distribution groups to prevent different group being used in Set vs Get
Pull Request (PR) description
Bug fix - at the moment, when deleting or setting a distribution group, we use the Identity parameter provided by the user.
However within Get-TargetResource, there is code to 'get' a different distribution group, if PrimarySmtpAddress is set (probably because similar to Name and Alias, this value is guaranteed unique within a tenant, and is also more intuitive).
However, when deleting or updating a DG, only the user-provided Identity parameter is used. If there were are two groups, one where the Name of the group matches the user-provided Identity, and another where the primary email address of the group matches the user-provided PrimarySmtpAddress, we will end up 'getting' and 'testing' the second group, but 'setting' or 'deleting' the first.
This update changes the set/delete behaviour to always use the Identity of the group previously retrieved via Get-TargetResource.
Inspired to check this via #4578 although I don't think this is the cause of the user's issue.
This Pull Request (PR) fixes the following issues
Task list
- [x] Added an entry to the change log under the Unreleased section of the file CHANGELOG.md. Entry should say what was changed and how that affects users (if applicable), and reference the issue being resolved (if applicable).
- [ ] Resource parameter descriptions added/updated in the schema.mof.
- [ ] Resource documentation added/updated in README.md.
- [ ] Resource settings.json file contains all required permissions.
- [ ] Examples appropriately added/updated.
- [ ] Unit tests added/updated.
- [x] New/changed code adheres to DSC Community Style Guidelines.
@NikCharlebois @ykuijs Any chance of a review / merge?
Thanks @NikCharlebois 👍