We have a need to change a number of user's IDs and keep their profiles, privileges, associated content references, etc.
We would like to either update the existing rep:principalName or create a new ID and copy all the nodes and properties from the old ID.
TeamSite used to have a manual process by changing an xml to force associations from one ID to another.
You can leverage groovy script to add a principal name.
Following script is to add rep:externalId property to user nodes. Similarly, you can update this script to add rep:principalName property.
I hope this helps.