Skip to content

Vso Subscription Apis

Suwat Ch edited this page Jan 14, 2016 · 4 revisions

- Get memberId

ARMClient.exe get "https://app.vssps.visualstudio.com/_apis/Commerce/Subscription?providerNamespaceId=VisualStudioOnline&queryOnlyOwnerAccounts=false&inlcudeDisabledAccounts=false&includeMSAAccounts=true"

NOTE: the memberId is available via X-VSS-UserData response header (for instance, <memberId>:<email>).

- List accounts and subscriptions by memberId.

ARMClient.exe get "https://app.vssps.visualstudio.com/_apis/Commerce/Subscription?providerNamespaceId=VisualStudioOnline&queryOnlyOwnerAccounts=false&inlcudeDisabledAccounts=false&includeMSAAccounts=true&memberId=%memberId%"

Below is excerpt from the response.

{
  "accountName": "<vsoAccountName>",
  "subscriptionId": "<subscriptionId>",  // if null, it meant the account is not linked with any subscription
  "subscriptionStatus": "active", // whether or not the subscription is active
  "resourceGroupName": "<resourceGroup>",
  "geoLocation": "<location>",
  "accountTenantId": "<aadTenantId>", // Guid.Empty indicates this account owned by non AAD-backed MSA account.
  "isAccountOwner": true, // whether or not the user is the owner of the account
}

There are three types of VSO accounts.

  • OrgId account.
  • AAD-backed MSA account.
  • Non AAD-backed MSA account.

To determine whether this VSO account is owned by OrgId or MSA account, look at the ARM token being used to call the api. If the ARM token contains idp claim with live.com value, then this VSO account is owned by MSA account. Otherwise, it is owned by OrgId account.

For MSA account, if the accountTenantId contains Guid.Empty, then this VSO account is owned by non AAD-backed MSA account.

NOTE: For VSO account owned by non AAD-backed MSA account, when using VSO api such as List Repositories, one must pass additional request header X-VSS-ForceMsaPassThrough: true. Vice versa, the header must not be passed for AAD-backed MSA account or OrdId account.

Clone this wiki locally