In many projects I come across there is a desire to add a Team Administrator to a VSTS Project. While there is allot of quality documentation, there is no clear route to add a Team Administator to a VSTS Project.
I investigated what calls the VSTS Web UI makes to add a team administrator and constructed a script that does exactly that.
The UI uses a simple method call this method: https://account.visualstudio.com/TeamPermissions/_api/_identity/AddTeamAdmins?__v=5 where it posts a piece of JSON. This basically consists of the Team ID and the user that you want to add.
However to construct this message you need to do several calls to get the required information. It involves getting all the Groups, Users and the users StorageKey to be able to add the administrator.
I created a script containing all the methods and supportive functions that can be found in my GitHub account here: https://github.com/JasperGilhuis/VSTS-RestAPI