Skip to content
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

Fix #3093 #3121

Merged
merged 16 commits into from
Apr 12, 2023
Merged

Fix #3093 #3121

merged 16 commits into from
Apr 12, 2023

Conversation

adrianvb
Copy link
Contributor

@adrianvb adrianvb commented Apr 2, 2023

Pull Request (PR) description

changed "Modules\Microsoft365DSC\DSCResources\MSFT_AADUser\MSFT_AADUser.psm1" to ignore the property "Password" on updates.

added a note to "docs\docs\resources\azure-ad\AADUser.md"

This Pull Request (PR) fixes the following issues

#3093

@adrianvb adrianvb requested a review from NikCharlebois as a code owner April 2, 2023 20:09
@adrianvb
Copy link
Contributor Author

adrianvb commented Apr 3, 2023

@microsoft-github-policy-service agree

@andikrueger
Copy link
Collaborator

Could you please add an entry in the changelog under UNRELEASED

@adrianvb
Copy link
Contributor Author

adrianvb commented Apr 3, 2023

done

@ykuijs ykuijs linked an issue Apr 3, 2023 that may be closed by this pull request
Copy link
Member

@ykuijs ykuijs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment

@@ -462,51 +462,59 @@ function Set-TargetResource
}
#endregion

if ($null -ne $Password)
if ($user.UserPrincipalName)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add:

$null -ne $user.UserPrincipalName


$stringPassword = (Get-Random -Count 15 -InputObject $StringSet) -join ''
$passwordValue = ConvertTo-SecureString $stringPassword -AsPlainText -Force
$stringPassword = (Get-Random -Count 15 -InputObject $StringSet) -join ''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We create a 30 character password above. We should do the same here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i intentionally didn't touch this code as it was already in the module and didn't want to commit changes out of scope of the original issue (#3093)

in my opinion the resource should only use one method to generate passwords and [system.web.security.membership] should be removed. i can prepare the code change and open a separate issue/pr for this.

@@ -11,7 +11,7 @@
| **Roles** | Write | StringArray[] | The list of Azure Active Directory roles assigned to the user. | |
| **UsageLocation** | Write | String | The country code the user will be assigned to | |
| **LicenseAssignment** | Write | StringArray[] | The account SKU Id for the license to be assigned to the user | |
| **Password** | Write | PSCredential | The password for the account. The parameter is a PSCredential object, but only the Password component will be used | |
| **Password** | Write | PSCredential | The password for the account. The parameter is a PSCredential object, but only the Password component will be used. If Password is not supplied for a new resource a new random password will be generated. Property will only be used when creating the user and not on subsequent updates. | |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is generated based on the information in the schema. Could you please also update the description of the Password parameter in the schema.mof, so this change isn't rolled back when the file is generated again.

Copy link
Member

@ykuijs ykuijs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last comment

Copy link
Member

@ykuijs ykuijs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the PR!

LGTM

@ykuijs ykuijs merged commit 2ffcedc into microsoft:Dev Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AADUser: Updating users and providing intial passwords at the same time.
3 participants