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

microsoft.ad.identity working example #26

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

microsoft.ad.identity working example #26

ba31 opened this issue Apr 27, 2023 · 2 comments · Fixed by #27

Comments

@ba31
Copy link

ba31 commented Apr 27, 2023

Please add the example of microsoft.ad.identity parameter. Its not clear in description how this should work and how it could change the sAMAccountName

@jborean93
Copy link
Collaborator

The identity field is only strictly necessary if you want to change the AD object name or path which are separate to the sAMAccountName. For example I have an AD user CN=testuser,CN=Users,DC=domain,DC=test with the sAMAccountName of test1. I do do the following to change the sAMAccountName.

- microsoft.ad.user:
    name: testuser  # Matches the first CN=... and is what appears in dsa.msc
    state: present
    sam_account_name: test2

The identity parameter is used only for trying to find a user that does not match what name and path specify. For example you want to change the user's name from testuser to otheruser

- microsoft.ad.user:
    name: otheruser
    identity: S-1-5-....  # Can be the objectGuid as well
    state: present

Instead of now creating a new user called otheruser it will modify the user object specified by identity to fit what is set there. I'll submit a PR to add an example of this but in your case it isn't needed for changing the sAMAccountName.

@jborean93
Copy link
Collaborator

The PR #27 tries to add some more examples which hopefully helps. You are more than welcome to modify the examples or add some more notes to the docs if you think more can be said about it.

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.

2 participants