Skip to content

Commit

Permalink
Default $identity to $sam_account_name if it's set, $name if it isn't (
Browse files Browse the repository at this point in the history
…#345)

* Default $identity to $sam_account_name if it's set, $name if it isn't

* Adding changelog entry
  • Loading branch information
jimbo8098 authored Dec 20, 2021
1 parent 8524b2c commit 65ddb71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelogs/fragments/345_win_domain_user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- win_domain_user - The AD user's existing identity is searched using their sAMAccountName name preferentially and falls back to the provided name property instead - https://github.com/ansible-collections/community.windows/issues/344
4 changes: 3 additions & 1 deletion plugins/modules/win_domain_user.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ $domain_server = Get-AnsibleParam -obj $params -name "domain_server" -type "str"

# User account parameters
$name = Get-AnsibleParam -obj $params -name "name" -type "str" -failifempty $true
$identity = Get-AnsibleParam -obj $params -name "identity" -type "str" -default $name
$description = Get-AnsibleParam -obj $params -name "description" -type "str"
$password = Get-AnsibleParam -obj $params -name "password" -type "str"
$password_expired = Get-AnsibleParam -obj $params -name "password_expired" -type "bool"
Expand All @@ -99,6 +98,9 @@ $enabled = Get-AnsibleParam -obj $params -name "enabled" -type "bool" -default $
$path = Get-AnsibleParam -obj $params -name "path" -type "str"
$upn = Get-AnsibleParam -obj $params -name "upn" -type "str"
$sam_account_name = Get-AnsibleParam -obj $params -name "sam_account_name" -type "str"
$identity = Get-AnsibleParam -obj $params -name "identity" -type "str" -default $sam_account_name

if ($null -eq $identity) { $identity = $name }

# User informational parameters
$user_info = @{
Expand Down

0 comments on commit 65ddb71

Please sign in to comment.