-
Notifications
You must be signed in to change notification settings - Fork 621
Add resource settings for AADUser with docs #6792
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
base: Dev
Are you sure you want to change the base?
Add resource settings for AADUser with docs #6792
Conversation
|
Can you provide additional details here? How will a customer specify within their configuration that they do not want the processing to happen? |
|
@NikCharlebois The configuration can be applied using the environment variable $resourceSettings = @(
@{ AADUserApplyMemberOf = $false }
) | ConvertTo-Json -Compress
[System.Environment]::SetEnvironmentVariable('M365DSC_RESOURCE_SETTINGS', $resourceSettings, 'Machine')Documentation for this feature is available in the Edit: Because the AADUser resource does not accept a parameter / property with which we can configure that, and other resources might have such things as well in the future (I can already think of some), and the LCM runs in the SYSTEM context instead of the currently logged on user, the configuration for this feature needs to live somewhere else. Environment variables in the machine context are the place I thought of - If you have other ideas, I'm open to them. |
|
Let me park this PR for a few more days to give me time to think this through and test it out. Thanks |
|
Absolutely, take your time. It's something I stumbled upon with another user and we started some discussions on how to resolve that. This is what I came up with - Any ideas are welcome. Such a feature (and other "feature flags") should be possible for a user of Microsoft365DSC to configure. In what way is to be defined. I can easily rewrite the logic to adapt for another mechanism, but some functionality needs to be implemented. |
|
I mentioned a few times in the past years implementing a resource dependency system either in settings.json files, or any other file, that way the resources could be either sorted in the blueprint since the LCM processes them from top to bottom in the order they appear in the blueprint, or even better like I explained in a couple of threads inject the FYI I have been using a mix of both in my solution, so my users don't need to mess with the order of the resources in the blueprint manually nor having to figure out the specific I even have another 3rd way of doing this, sure enough is the worst of all these and not recommended which is to process only certain resources (the ones that can be dependencies for other resources) in a first deployment without specific properties, then do a second deployment with the those properties back in, in this specific case I think I process the |
|
I once mentioned implementing the |
|
Sure, this definitely scratches an itch and fixes this specific issue with minimal changes, any other dependency system implementation is beyond the scope of the PR and should involve more thought about it. |
Pull Request (PR) description
This PR adds the new function
Get-M365DSCResourceSettingsto the M365DSCUtil module and includes documentation on how to skip theMemberOfprocessing for theAADUserresource.In tenant cloning scenarios, especially when migrating users and / or groups, the members of the groups or the groups itself might not exist. This introduces issues, where errors might occur if a member is not found (because it doesn't exist) or assigning a user to a group fails (because it too doesn't exist). With using the resource setting
AADUserApplyMemberOfwith either true or false, it's possible to stop processing theMemberOfand only let theAADGroupmanage the members. This solves the problem when creating users first and only after all of the users exist, then the groups are deployed. If this was not the case and a group wouldn't exist, errors would be thrown and the configuration would need to be applied multiple times until it succeeds.This Pull Request (PR) fixes the following issues
None.
Task list
Entry should say what was changed and how that affects users (if applicable), and
reference the issue being resolved (if applicable).