From ff184b0815cdbf7dc222fd9d7b0cfaa93d5fe03c Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Fri, 25 Mar 2022 05:01:45 +1000 Subject: [PATCH] SID - Use literal UPN value when attempting a user to SID lookup (#77334) --- changelogs/fragments/ModuleUtils.SID-long-username.yml | 2 ++ .../module_utils/powershell/Ansible.ModuleUtils.SID.psm1 | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) create mode 100644 changelogs/fragments/ModuleUtils.SID-long-username.yml diff --git a/changelogs/fragments/ModuleUtils.SID-long-username.yml b/changelogs/fragments/ModuleUtils.SID-long-username.yml new file mode 100644 index 00000000000..dbf02cee0e2 --- /dev/null +++ b/changelogs/fragments/ModuleUtils.SID-long-username.yml @@ -0,0 +1,2 @@ +bugfixes: +- Ansible.ModuleUtils.SID - Use user principal name as is for lookup in the ``Convert-ToSID`` function - https://github.com/ansible/ansible/issues/77316 diff --git a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.SID.psm1 b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.SID.psm1 index d6f8ecff5aa..d1f4b62d8d6 100644 --- a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.SID.psm1 +++ b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.SID.psm1 @@ -49,11 +49,6 @@ Function Convert-ToSID { } $username = $account_name_split[1] } - elseif ($account_name -like "*@*") { - $account_name_split = $account_name -split "@" - $domain = $account_name_split[1] - $username = $account_name_split[0] - } else { $domain = $null $username = $account_name