You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用VSTS API获取个人资料时个人账号遭遇ProfileNotFoundException求助

Troubleshooting ProfileNotFoundException with Personal Accounts for the VSS Profile API

Hey there, let's break down why your personal account is hitting a ProfileNotFoundException while your school/enterprise account works fine with the API GET https://app.vssps.visualstudio.com/_apis/profile/profiles/me?api-version=1.0:

Key Context First

School/enterprise accounts are typically tied to Azure AD, which automatically provisions a user profile in the Visual Studio Services (VSS) ecosystem when you first access related services (like Azure DevOps). Personal Microsoft accounts (e.g., outlook.com, hotmail.com) don’t get this automatic provisioning—you need to trigger profile creation manually.

Step-by-Step Fixes to Try

  • Manually create your VSS profile with the personal account
    Log into the Azure DevOps web portal using your personal account. Go through any initial setup prompts (like setting a display name or configuring your profile). This will create the necessary profile record in VSS, which the API needs to fetch data. After this, retry the profiles/me API call.

  • Update your API version
    The api-version=1.0 you’re using is quite outdated. Newer API versions have better support for personal accounts. Try switching to a recent stable version like api-version=7.1-preview.3 or the latest stable release. Your updated request would look like:

    GET https://app.vssps.visualstudio.com/_apis/profile/profiles/me?api-version=7.1-preview.3
    
  • Verify your authentication token
    Double-check the JWT token you’re using for the personal account:

    1. Decode the token using an offline tool (to avoid external links)
    2. Ensure the aud (audience) claim is set to https://app.vssps.visualstudio.com/
    3. Confirm the scopes include vso.profile_read—this permission is required to fetch profile data. If it’s missing, you’ll need to re-authenticate with the correct scope.
  • Try using your user ID instead of /me
    If /me still fails after the above steps, first fetch your personal account’s user ID with this API call:

    GET https://app.vssps.visualstudio.com/_apis/connecteduser?api-version=7.1-preview.1
    

    Then replace /me in your original request with the returned user ID, like:

    GET https://app.vssps.visualstudio.com/_apis/profile/profiles/{your-user-id}?api-version=7.1-preview.3
    

Why This Works for Enterprise/School Accounts

As mentioned earlier, enterprise/school accounts are integrated with Azure AD, which automatically creates a VSS profile when the account is added to the organization’s Azure AD tenant or when you first access VSS services. Personal accounts don’t have this automated setup, so the profile record doesn’t exist until you manually trigger it.

内容的提问来源于stack exchange,提问作者DevTard

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:14:27