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 support functions that can be found in my GitHub account here: https://github.com/JasperGilhuis/VSTS-RestAPI
Update 2020-04-01
An easier approach to this would be to use the Azure DevOps CLI. For information about the CLI look here: Azure DevOps CLI
I have created a GitHub Gist as an example! Thanks to David for the StackOverflow post with the example! Thanks for reaching out Geert to my post!