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

New-ADUser failed: A parameter cannot be found that matches parameter name 'PasswordExpired'." #25

Closed
ba31 opened this issue Apr 27, 2023 · 0 comments · Fixed by #29
Closed

Comments

@ba31
Copy link

ba31 commented Apr 27, 2023

SUMMARY

Unable to set password expired to at the time user creation. password_expired can only be set once user is created. otherwise its generate error "New-ADUser failed: A parameter cannot be found that matches parameter name 'PasswordExpired'."

ISSUE TYPE

"msg": "New-ADUser failed: A parameter cannot be found that matches parameter name 'PasswordExpired'.", "object_guid": null}

COMPONENT NAME

microsoft.ad.user

ANSIBLE VERSION
ansible [core 2.13.9]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/demo/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/demo/.local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/demo/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Nov 14 2022, 12:59:47) [GCC 9.4.0]
  jinja version = 3.1.2
  libyaml = True

COLLECTION VERSION
Collection        Version
----------------- -------
community.general 6.6.0
OS / ENVIRONMENT

Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

STEPS TO REPRODUCE
    - name: prepare user for login
      microsoft.ad.user:
        name: test
        upn : test@example.com
        firstname: login
        lastname: testuser
        password: password
       password_expired: true

ansible-playbook -i hosts microsoft.ad.user.yaml

If I create following tasks playbook than it does not throw error

    - name: prepare user for login
      microsoft.ad.user:
        name: test
        upn : test@example.com
        firstname: login
        lastname: testuser
        password: password

    - name: password expiry
      microsoft.ad.user:
        name: test
        password_expired: true

ansible-playbook -i hosts microsoft.ad.user.yaml

EXPECTED RESULTS

It should not generate "A parameter cannot be found " and should create the user with PasswordExpired attribute

ACTUAL RESULTS

"msg": "New-ADUser failed: A parameter cannot be found that matches parameter name 'PasswordExpired'.", "object_guid": null}

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 a pull request may close this issue.

1 participant