When PCF Operator attempts to delete a user account, it results in failure:
#cf delete-user foo@bar Error deleting user foo@bar Multiple users with that username found. Please use 'cf curl' to delete the user by guid instead.
There are duplicate users with the same user-name. CAPI cannot safely remove a user from the username since they are not unique. Therefore the user must be removed by GUID instead.
The user needs to be removed manually both by `cf curl` and by `uaac` client.
Follow the steps to resolve this issue:
1. List the users and find the GUID for the user that you want to delete:
cf curl /v2/users |egrep "name|guid|created_at"
2. Confirm the metadata of a GUID that you want to delete:
cf curl /v2/users/hM83mPEEp8BWMNohM5-cHZPy33gszsRt
3. Delete the user by GUID with the command:
cf curl -X DELETE /v2/users/hM83mPEEp8BWMNohM5-cHZPy33gszsRt
4. Now log into uaac client with UAA admin credentials (Elastic Runtime > Credentials > UAA Admin credentials).
Note: This article assumes that Elastic Runtime is configured for internal authentication. If you are using LDAP/SAML then it will be necessary to delete user record manually from the external identity provider.
Reference: https://docs.cloudfoundry.org/uaa/uaa-user-management.html
5. Find the id of the user you wish to delete:
uaac users 'username eq "email@gmail.com" and origin eq "uaa"'
6. Delete the userID with the command:
uaac curl -XDELETE -H"If-Match: *" /Users/<insert user_id_here>
The user is now deleted.