[8.17](backport #5988) Add support for pre existing Active Directory user #6201
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Waiting on custom windows image for testing with AD e2e.
New flags are introduced
These flags are taken into account only when
--unprivileged
is used.New user is added same permissions as elastic-agent user when created in order to be able to log on as a service (otherwise agent won't start)
Custom user won't be created and needs to be present
Testing steps
Create a windows VM (windows server 2022)
Run script 1 that will prepare Active Directory
Script will also wait for AD services to start
Reboot to make changes effective
Run script that will prepare user
Scenario 1
elastic-agent install --unprivileged --user="testing.local\TestUser" --password=Changeme123+
Scenario 2
elastic-agent unprivileged --user="testing.local\TestUser" --password=Changeme123+
Resolves #4585
This is an automatic backport of pull request #5988 done by Mergify.