Skip to content

Enable VS Code sign‑in with Microsoft Entra ID to connect to Private Marketplace #280376

Closed

Description

@seaniyer

As an enterprise developer signed into VS Code with Microsoft Entra ID (formerly Azure AD), I want VS Code to automatically discover and connect to my organization’s Private Marketplace, so I can access internal extensions.

User Story
As an enterprise developer
When I sign into VS Code using my Microsoft Entra ID work account
Then VS Code should securely connect to my organization’s Private Marketplace.

Problem / Pain Points
VS Code currently enables connecting to Private Marketplace by signing in with GitHub Enterprise (GHE) / Copilot (Pro/Enterprise). Many enterprises that use GHE do not have seats/subscriptions for 100% of developers who need to use Private Marketplace. On the other hand all their developers have and can sign with an Entra ID work account. These organizations are currently unable to roll out to Private Marketplace for production use.

Acceptance Criteria
When Private Marketplace is configured through policy settings, signing in with either GHE, Copilot (PRO/ENT) or Entra ID work account should connect VS Code to the organization's Private Marketplace.

Activity

  1. seaniyer commented on Dec 1, 2025

    @seaniyer
    Author
  2. added
    feature-request
    extensions
    on Dec 9, 2025
  3. mcumming commented on Mar 2, 2026

    @mcumming
    Contributor

    Plan: Entra ID & Visual Studio Subscription Eligibility for Private Marketplace

    Overview

    The Private Marketplace currently only allows access via GitHub Enterprise / Copilot sign-in, blocking enterprise customers who use Microsoft Entra ID or Visual Studio Subscriptions. This plan adds two new eligibility paths — Entra ID and Visual Studio Subscription — alongside the existing GitHub path.

    A new enterprise policy field (extensions.gallery.authProvider) tells VS Code which auth provider the configured marketplace accepts. GalleryManifestService reads this policy and routes to the correct auth flow — either the existing GitHub/GHE path or a new Microsoft path. When the user needs to sign in, VS Code tells them exactly which account to use based on the policy — no picker, no guessing. Account classification and subscription checks happen server-side on the Private Marketplace — the VS Code client never parses tokens.

    Eligibility Matrix

    Path Eligible Notes
    GitHub Enterprise / Copilot Yes Existing (unchanged)
    Entra ID (work/school) Yes New
    Visual Studio Subscription Yes New — regardless of sign-in type
    MSA only, no VSS No Explicitly excluded

    Key Architecture Decisions

    Decision Outcome
    Provider routing New extensions.gallery.authProvider policy field ('github' or 'microsoft')
    Service design No new service — Microsoft auth logic (~40 lines) added directly to GalleryManifestService
    Sign-in UX Provider-specific sign-in message (no picker — policy determines the provider)
    Account type detection Server-side classification by Private Marketplace (no client token parsing)
    VSS entitlement check Server-side proxy via Private Marketplace → Ev4 API
    Eligibility API hosting Private Marketplace (Gallery Backend)
    Caching Access result cached in storage above provider routing; only invalidated by auth service responses, never by network errors

    Proposal

    Eligibility Check Flow

    GalleryManifestService caches the access result in IStorageService and checks it before contacting any auth provider. If a cache hit exists, the result is applied immediately (marketplace available without delay) and the provider-specific check runs in the background. Both flows benefit equally.

    Startup (cache-first):

    1. Read cached access result from storage
    2. If cache hit → apply immediately (show marketplace or appropriate status)
    3. Background-validate via the auth provider (steps below)
    4. If no cache → run provider check synchronously (user waits)

    GalleryManifestService reads the extensions.gallery.authProvider policy and routes to one of two flows:

    GitHub provider (authProvider = 'github' or unset — existing behavior, unchanged):

    1. GalleryManifestService → DefaultAccountService.getDefaultAccount()
    2. checkAccess(account) — enterprise flag or Copilot SKU match
    3. Eligible → cache result, fetch manifest; Ineligible → cache result, AccessDenied
    4. Auth service error (e.g. unavailable) → do nothing, keep existing cache

    Microsoft provider (authProvider = 'microsoft' — new):

    1. GalleryManifestService → IAuthenticationService.getSessions('microsoft', scopes)
    2. Auth service unavailable (throws) → do nothing, keep existing cache
    3. No session (auth service responded) → clear cache, RequiresSignIn ("Sign in with your Microsoft account")
    4. Has session → POST token to Private Marketplace eligibility endpoint
    5. Server returns 200 → cache the definitive result
    6. Server error (non-200) → do nothing, keep existing cache
    7. Server validates token, inspects tid claim:
      • Entra ID (work/school) → eligible
      • MSA → check VS Subscription entitlements server-side via Ev4 API
      • MSA with active qualifying subscription → eligible
      • MSA without subscription → ineligible
    8. Eligible → fetch manifest; Ineligible → AccessDenied

    Auth Flow: Microsoft Provider

    sequenceDiagram
        participant User
        participant Viewlet as Extensions Viewlet
        participant GMS as GalleryManifestService
        participant Storage as IStorageService
        participant Auth as IAuthenticationService
        participant PM as Private Marketplace
    
        User->>Viewlet: Open Extensions
        Viewlet->>GMS: getExtensionGalleryManifest()
    
        GMS->>Storage: Read cached access result
        Storage-->>GMS: Cached result (or null)
    
        alt Cache hit
            GMS->>Viewlet: Apply cached status immediately
            Note over GMS: Background validate via auth provider
        end
    
        Note over GMS: Policy says authProvider = 'microsoft'
    
        GMS->>Auth: getSessions('microsoft', scopes)
        Auth-->>GMS: Microsoft session (or null)
    
        alt No session (auth service responded)
            GMS->>Storage: Clear cache
            GMS->>Viewlet: RequiresSignIn
            Viewlet->>User: "Sign in with your Microsoft account"
            User->>Viewlet: Clicks sign-in
            Viewlet->>Auth: createSession('microsoft', scopes)
            Auth-->>GMS: Session available (via onDidChangeSessions)
        end
    
        GMS->>PM: POST /eligibility (Bearer token)
        Note over PM: Validate token, inspect tid claim
        Note over PM: Entra → eligible
        Note over PM: MSA → check VSS entitlements
        PM-->>GMS: { eligible, reason }
    
        GMS->>Storage: Cache definitive result (200 OK only)
    
        alt Eligible
            GMS->>GMS: Fetch gallery manifest
            GMS->>Viewlet: Available
            Viewlet->>User: Show marketplace extensions
        else Ineligible
            GMS->>Viewlet: AccessDenied
            Viewlet->>User: "Your account does not have access"
        end
    
        alt Network/server error
            Note over GMS: Keep existing cache — never invalidate on transient errors
        end
    
    Loading

    Auth Flow: GitHub Provider (unchanged)

    When authProvider is 'github' (or unset), the existing flow is preserved exactly:
    GalleryManifestService → DefaultAccountService.getDefaultAccount() → checkAccess(account).

    No changes to the GitHub path.

    Sign-In UX

    The sign-in prompt tells the user exactly which account to use, based on the authProvider policy — no provider picker needed.

    The sign-in command reads the policy and routes directly:

    • authProvider === 'microsoft' → authenticationService.createSession('microsoft', scopes)
    • Otherwise → commandService.executeCommand(DEFAULT_ACCOUNT_SIGN_IN_COMMAND) (existing GitHub flow)

    UX Messages

    State Microsoft provider GitHub provider (default)
    RequiresSignIn "Sign in with your Microsoft account to access the Extensions Marketplace." "Sign in with GitHub to access the Extensions Marketplace."
    AccessDenied "Your Microsoft account does not have access. An Entra ID (work or school) account or Visual Studio Subscription is required." "Your account does not have access. Please contact your administrator."

    Caching & Air-Gapped Support

    The access result is cached in IStorageService (StorageScope.APPLICATION, StorageTarget.MACHINE) and sits above provider routing, following the same pattern as DefaultAccountService. Both GitHub and Microsoft flows read from and write to the same cache. This ensures the marketplace works on reload even when connectivity is unavailable.

    Behavior:

    • Startup with cache: Apply cached result immediately (before any auth or network calls), then validate via the auth provider in the background. If the background result differs, update status.
    • Startup without cache: Check eligibility synchronously via the provider (user waits for result).
    • Network/server error with cache: Keep using cached result — don't disrupt the user. Cache is never touched.
    • Network/server error without cache: No status change (user sees initial state).

    Cache is invalidated when (auth service responses only):

    • onDidChangeSessions('microsoft') — auth service reports session added, removed, or changed
    • onDidChangeDefaultAccount — auth service reports GitHub account changed or removed
    • getSessions() returns empty array — auth service confirms no sessions exist (sign-out)
    • Policy configuration changes — admin changed authProvider or serviceUrl

    Cache is NOT invalidated when:

    • Network timeout or DNS failure contacting the eligibility endpoint
    • Eligibility endpoint returns non-200 (server error, 500, 503, etc.)
    • getSessions() throws (auth service itself is unavailable)
    • Manifest fetch fails after a successful eligibility check
    • Any transient or recoverable error

    Policy Configuration

    Modify: src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts

    • Add extensions.gallery.authProvider policy-controlled configuration (string enum: 'github' | 'microsoft')

    Modify: src/vs/platform/extensionManagement/common/extensionGalleryManifest.ts

    • Add ExtensionGalleryAuthProviderConfigKey constant

    Gallery Manifest Integration

    Modify: src/vs/workbench/services/extensionManagement/electron-browser/extensionGalleryManifestService.ts

    • Add IAuthenticationService and IStorageService to constructor DI
    • Read cached access result on startup before provider routing — apply immediately if present
    • Add provider routing in doGetExtensionGalleryManifest() — read extensions.gallery.authProvider to choose GitHub or Microsoft path
    • Both handleGitHubAccess() and handleMicrosoftAccess() cache their results on success
    • Add getCachedAccess() / cacheAccess() / clearCachedAccess() — provider-agnostic, persist in IStorageService
    • Only cache definitive results: 200 OK from eligibility endpoint, or definitive checkAccess result
    • Never invalidate cache on network/transient errors — only on auth service responses
    • Add checkMicrosoftEligibility() — HTTP POST; throws on non-200 (server errors are not cacheable)
    • Subscribe to onDidChangeSessions('microsoft') / onDidChangeDefaultAccount — clear cache and re-evaluate
    • Set marketplaceAuthProvider context key from policy value

    Extensions UI

    Modify: src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts

    • Provider-aware RequiresSignIn: Microsoft → "Sign in with your Microsoft account"; GitHub → "Sign in with GitHub"
    • Provider-aware AccessDenied: Microsoft → "Entra ID or VSS required"; GitHub → "Contact your administrator"
    • Messages conditioned on marketplaceAuthProvider context key

    Modify: src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts

    • Provider-routed sign-in command (reads authProvider policy, routes to correct createSession call)

    Modify: src/vs/workbench/contrib/extensions/common/extensions.ts

    • Add context key: marketplaceAuthProvider (string, set from policy)

    Product Configuration

    Modify: product.json — add microsoft to trustedExtensionAuthAccess:

    "trustedExtensionAuthAccess": {
        "github": ["GitHub.copilot-chat"],
        "github-enterprise": ["GitHub.copilot-chat"],
        "microsoft": []
    }

    The microsoft entry reserves the key for future extension-based callers. Since the eligibility service runs in the workbench (main process), it may not need explicit trust — but this should be verified during implementation by testing whether getSessions('microsoft') returns sessions without a trust prompt.


    Open Questions / Dependencies

    • Private Marketplace eligibility endpoint URL and API contract (TBD)
    • Ev4 onboarding: Private Marketplace AAD app registration with VS Subscriptions team
    • Microsoft auth scopes for eligibility endpoint (TBD)
    • Qualifying subscriptionLevelCode / subscriptionChannel combinations (coordinate with Aaron Mast / Chee Seong Ong)
    • Air-gapped / offline: Resolved — access result is cached in storage (StorageScope.APPLICATION) above provider routing. On startup, the cached result is applied immediately before any auth or network calls. Background validation runs through the provider flow when connectivity is available. Cache is only invalidated by auth service responses, never by network errors.
  4. mcumming commented on Mar 4, 2026

    @mcumming
    Contributor
  5. digitarald commented on Mar 30, 2026

    @digitarald
    Contributor

    Sandeep Somavarapu (@sandy081) could you please help with a plan review, so Michael Cummings (MSFT) (@mcumming) has confidence that their approach is on the right track.

  6. sandy081 commented on Apr 16, 2026

    @sandy081
    Member

    Michael Cummings (MSFT) (@mcumming) Thanks for the proposal. Lets discuss the flow / steps one by one to see if we are covering all scenarios and going in the right direction.

    • I like that you want to show sign in when user does not have access to private marketplace. How do you detect that? Lets say if user is already signed into GH.com / MSFT or both with Private Marketplace configured - how do you determine if the user has access to the Private Marketplace or not?

    • When user is not signed in to either GH / MSFT, how does user knows which account to pick if we show both options so that user gets access to the Private Marketplace?

  7. mcumming commented on Apr 16, 2026

    @mcumming
    Contributor

    Sandeep Somavarapu (@sandy081)

    1. I like that you want to show sign in when user does not have access to private marketplace. How do you detect that? Lets say if user is already signed into GH.com / MSFT or both with Private Marketplace configured - how do you determine if the user has access to the Private Marketplace or not?

    This is how the Extension view works today, but without the added EntraID auth. I describe the updated flow here:

    Eligibility Check Flow

    1. GalleryManifestService → MarketplaceEligibilityService.checkEligibility()
    2. Path 1 (GitHub/GHE): Check existing DefaultAccountService — enterprise flag or Copilot SKU match
    3. Path 2 (Entra ID): If no GitHub access, send Microsoft auth token to Private Marketplace eligibility endpoint. Server validates token and classifies via tid claim. Entra ID accounts are eligible.
    4. Path 3 (VSS): If MSA account, Private Marketplace checks VS Subscription entitlements server-side via Ev4 API. Active qualifying subscription = eligible.
    5. First eligible path wins (priority order: GHE → Entra → VSS)

    The new MarketplaceEligibilityService sits between the GalleryManifestService and the auth providers, evaluating eligibility across three independent paths before the manifest service makes its access decision.

    %%{init: {'theme': 'base', 'themeVariables': {
        'background': '#ffffff',
        'primaryTextColor': '#212121',
        'lineColor': '#37474f',
        'labelBoxBkgColor': '#ffffff',
        'labelBoxBorderColor': '#37474f',
        'labelTextColor': '#1a237e',
        'signalColor': '#37474f',
        'signalTextColor': '#0d47a1',
        'noteBkgColor': '#e3f2fd',
        'noteBorderColor': '#1565c0',
        'noteTextColor': '#0d47a1',
        'actorBkg': '#e8eaf6',
        'actorBorder': '#3949ab',
        'actorTextColor': '#1a237e',
        'activationBkgColor': '#c5cae9',
        'activationBorderColor': '#3949ab',
        'sequenceNumberColor': '#ffffff'
    }}}%%
    sequenceDiagram
        participant User
        participant Viewlet as Extensions Viewlet
        participant GMS as GalleryManifestService
        participant MES as MarketplaceEligibilityService
        participant DAS as DefaultAccountService
        participant GitHub as GitHub Auth Provider
        participant MSFT as Microsoft Auth Provider
        participant PM as Private Marketplace
        participant Ev4 as Ev4 Entitlement API
    
        User->>Viewlet: Open Extensions
        Viewlet->>GMS: getExtensionGalleryManifest()
        GMS->>MES: checkEligibility()
    
        Note over MES: Path 1 — GitHub/GHE
        rect rgb(227, 242, 253)
            MES->>DAS: getDefaultAccount()
            DAS-->>MES: IDefaultAccount (or null)
        end
    
        alt GitHub account eligible
            rect rgb(187, 222, 251)
                MES-->>GMS: ✅ Eligible (GitHubEnterprise / CopilotSKU)
            end
        else No GitHub access — fall through to Path 2
            Note over MES: Path 2 — Entra ID
            rect rgb(232, 245, 233)
                MES->>MSFT: getSessions('microsoft')
                MSFT-->>MES: Microsoft session (or null)
            end
    
            alt Has Microsoft session
                rect rgb(200, 230, 201)
                    MES->>PM: POST token → classify + eligibility
                    Note over PM: Validate token, inspect tid claim
                    PM-->>MES: { accountType, eligible, reason }
                end
    
                alt Entra ID account (tid ≠ MSA tenant)
                    rect rgb(165, 214, 167)
                        MES-->>GMS: ✅ Eligible (EntraID)
                    end
                else MSA account (tid = 9188…6dad) — fall through to Path 3
                    Note over PM: Path 3 — VSS check (server-side)
                    rect rgb(255, 243, 224)
                        PM->>Ev4: POST GetEntitlements (service-to-service)
                        Ev4-->>PM: entitlements array
                        PM->>PM: Filter qualifying subscriptionLevelCode
                    end
    
                    alt Active qualifying VSS subscription found
                        rect rgb(255, 224, 178)
                            MES-->>GMS: ✅ Eligible (VisualStudioSubscription)
                        end
                    else No qualifying subscription
                        rect rgb(255, 205, 210)
                            MES-->>GMS: ❌ Ineligible
                        end
                    end
                end
    
            else No Microsoft session
                rect rgb(255, 205, 210)
                    MES-->>GMS: ❌ Ineligible (no accounts)
                end
            end
        end
    
        Note over GMS: Final UI decision
        alt Eligible
            rect rgb(200, 230, 201)
                GMS->>Viewlet: Available
                Viewlet->>User: Show marketplace extensions
            end
        else RequiresSignIn (no accounts at all)
            rect rgb(255, 249, 196)
                GMS->>Viewlet: RequiresSignIn
                Viewlet->>User: "Sign in to access Extensions Marketplace"
                User->>Viewlet: Clicks sign-in
                Viewlet->>User: Quick pick: GitHub / Microsoft
            end
        else Ineligible
            rect rgb(255, 205, 210)
                GMS->>Viewlet: AccessDenied
                Viewlet->>User: "Try signing in with a different account"
            end
        end
    
    Loading

    Color key:

    Color Meaning
    🔵 Blue Path 1 — GitHub / GHE eligibility
    🟢 Green Path 2 — Entra ID eligibility
    🟠 Orange Path 3 — VSS entitlement check
    🟡 Yellow Requires sign-in (prompt state)
    🔴 Red Ineligible / access denied
    1. When user is not signed in to either GH / MSFT, how does user knows which account to pick if we show both options so that user gets access to the Private Marketplace?

    This is something that would have to come from the user's administrator. If the user is unsure and randomly picks one, and it doesn't provide access, then they are prompted to try a different authentication method. So, if they try EntraId first and it doesn't provide access then they can try again with GitHub, or vice versa.

    We could allow the Admin to push a specific provider through the Enterprise policies.

  8. sandy081 commented on Apr 22, 2026

    @sandy081
    Member

    This is something that would have to come from the user's administrator. If the user is unsure and randomly picks one, and it doesn't provide access, then they are prompted to try a different authentication method. So, if they try EntraId first and it doesn't provide access then they can try again with GitHub, or vice versa.

    I think the user should have a deterministic behaviour here meaning we should show the account that user can use to get the marketplace info rather than asking user to do a try / check approach.

  9. mcumming commented on Apr 22, 2026

    @mcumming
    Contributor

    To do that, we could add an additional Enterprise policies to set which provider to use. Acceptable, or do you have other ideas?

  10. sandy081 commented on Apr 22, 2026

    @sandy081
    Member

    Regarding the enterprise policy decision — I'd defer to Harald Kirschner (@digitarald) on whether an additional policy is the right mechanism.

    From a product perspective, the key requirement is: when the user needs to sign in, VS Code should tell them which account to use — not ask them to guess. If the policy configuration indicates which auth provider(s) the marketplace accepts, the sign-in UX can show only the valid option(s) directly.

    Given that this information can be made available, could you revisit the design with that in mind? Specifically:

    • If we know upfront which provider the configured marketplace accepts, do we still need a separate MarketplaceEligibilityService? Or can the existing GalleryManifestService handle this with the provider info from the policy?
    • The current 3-path waterfall (GHE → Entra → VSS) assumes we don't know which path will work. If we do know, the design can be significantly simpler.
  11. mcumming commented on Apr 22, 2026

    @mcumming
    Contributor

    I've updated the plan to reflect the changes. Assuming that we can provide the recommended auth provider to use, whether it is from a policy or not, but the plan is written using a policy.

  12. sandy081 commented on Apr 23, 2026

    @sandy081
    Member

    Michael Cummings (MSFT) (@mcumming) Thanks for revising the plan — the direction looks good. The policy-driven provider routing and the simplified GalleryManifestService integration are much cleaner than the original 3-path waterfall.

    A couple of things to address before implementation:

    1. trustedExtensionAuthAccess in product.json — I don't think this change is needed since GalleryManifestService is workbench code, not an extension calling through the extension host. But TylerLeonhardt knows this area best — can you confirm?

    2. Caching & air-gapped scenarios — The eligibility check result from the Private Marketplace should be cached in storage so the marketplace works on reload even when connectivity is unavailable (air-gapped deployments, transient network issues). On startup, use the cached result immediately but validate it in the background. The cache should be invalidated on session change or sign-out. Take a look at DefaultAccountService — it implements a similar caching pattern that you can follow.

  13. mcumming commented on Apr 23, 2026

    @mcumming
    Contributor

    Caching & air-gapped scenarios — The eligibility check result from the Private Marketplace should be cached in storage so the marketplace works on reload even when connectivity is unavailable (air-gapped deployments, transient network issues). On startup, use the cached result immediately but validate it in the background. The cache should be invalidated on session change or sign-out. Take a look at DefaultAccountService — it implements a similar caching pattern that you can follow.

    Sandeep Somavarapu (@sandy081) Updated the plan to use caching.

    TylerLeonhardt, if I can get an answer on the trustedExtensionAuthAccess in product.json change being required or not, that would be great.

    Harald Kirschner (@digitarald), if you could answer if an additional policy is the right mechanism, or offer a better alternative, that would be much appreciated.

  14. mcumming commented on Apr 28, 2026

    @mcumming
    Contributor
  15. joshspicer commented on May 4, 2026

    @joshspicer
    Contributor

    Harald Kirschner (@digitarald), if you could answer if an additional policy is the right mechanism, or offer a better alternative, that would be much appreciated.

    👋 Not all marketplaces will require authentication, right? Could the marketplace negotiate what kind of authentication it expects? I'm thinking like how WWW-Authenticate headers declare a 'realm' on a 401.

    We do this in the dev containers CLI to talk to OCI (container) registries behind auth. I think MCP registry auth follows this standard similarly.

    Apologies that I'm catching up a bit here - but is that at all feasible? It would prevent org admins from needing to explicitly set another policy, which feels like a win.

  16. sandy081 commented on Oct 21, 2026

    @sandy081
    Member

    Thanks for the request and the detailed design work. Microsoft Entra ID access for a policy-configured Private Marketplace was implemented in 3d7597c via #325331: administrators can select microsoft with extensions.gallery.authProvider, and eligible work/school sessions activate the configured marketplace. The additional authenticated-index negotiation is tracked separately in #325412, so this request can be closed as completed. The fix shipped in 1.137.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

extensionsfeature-requestverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions