-
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
AADUser: Updating users and providing intial passwords at the same time. #3093
Comments
If no Password is provided, we generate a random password for the users via at creation:
|
There is a cmdlet to change a user's password, but it requires both the current password and the new password. Off course we cannot retrieve the current password with M365DSC so this is not something we can use: My recommendation would be to update the code to simply stop to attempt to update the password when another property is modified. The resource would let you specify the initial password, but after that, the password can't be managed via DSC. Would that change solve your issue? |
Yes, that would solve my use case. |
That would be great. Let us know if you have any questions. Thanks |
what a ride: i had to symlink/junction my fork in "C:\Program Files\WindowsPowerShell\Modules" so the LCM picks up the changes as well. Is there a better way? The code change itself was rather quick, i hope this is in line with your idea for the solution. |
Details of the scenario you tried and the problem that is occurring
My first use case for M365 DSC is to provision users for a small tenant. ApplicationID and certificate thumbprint are used to authenticate.
After changing a property of the user and re-running the ressource i get (debug log further down)
I checked the graph documentation and it seems applications cannot change passwords: https://learn.microsoft.com/en-us/graph/api/user-changepassword?view=graph-rest-1.0&tabs=http
But MSFT_AADUser.psm1 always tries to set the password (even if none is provided?).
My first idea was to provide an additional parameter for the Set-Resource Method called "$InitialPassword" which is only used when New-MgUser is called or to never update a password, when an application is used for authentication.
Which is the "M365 DSC way" to solve this?
Verbose logs showing the problem
debug log for patch method
Suggested solution to the issue
a.) never set the password when using application id and user is already provisioned
b.) add a new parameter $InitialPassword and use it when creating a user
if you point me in the right direction i'd love to implement the solution
Version of the DSC module that was used ('dev' if using current dev branch)
1.23.322.1
The text was updated successfully, but these errors were encountered: