-2

I need to create lots of VSTS account xxxx.visualstudio.com (e.g. 1000 account) so rather than creating manual, i want to use powershell script to create these account automated.

is it possible to create VSTS account and give user permission using powershell script? if yes, could you please provide the sample for this?

Thanks Sachin

  • This is something you can find out using google for 1minute... StackOverflow isn't a Code Writing service. Please only ask questions if you got a problem with code you wrote. – Paxz Jun 27 '18 at 08:04

1 Answers1

0

You can use add User Entitlements REST API to add a user, assign license and extensions and make them a member of a project group in an account. Here is an example for your reference:

POST https://{accountName}.vsaex.visualstudio.com/_apis/userentitlements?api-version=4.1-preview.1

{
  "accessLevel": {
    "accountLicenseType": "express"
  },
  "extensions": [
    {
      "id": "ms.feed"
    }
  ],
  "user": {
    "principalName": "newuser@fabrikam.com",
    "subjectKind": "user"
  },
  "projectEntitlements": [
    {
      "group": {
        "groupType": "projectContributor"
      },
      "projectRef": {
        "id": "e5943a98-xxxx-4001-bd3b-06e756a7dfac"
      }
    }
  ]
}
Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39