Skip to content

Sync PAC CLI auth state before showing "auth profile not found" prompt#1543

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-auth-profile-not-found
Draft

Sync PAC CLI auth state before showing "auth profile not found" prompt#1543
Copilot wants to merge 3 commits intomainfrom
copilot/fix-auth-profile-not-found

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 8, 2026

When clicking Login in the Power Pages Actions Hub, users with an existing PAC CLI auth profile were shown a confusing "Active auth profile is not found or has expired" input box. This happens because createNewAuthProfile only checked PacContext (which relies on a file watcher chain) rather than querying PAC CLI directly.

Changes

  • CreateNewAuthProfileHandler.ts: Added syncAuthFromPacCli() that queries PAC CLI via activeAuth()/activeOrg() and populates PacContext before falling back to the input box flow. The login handler now follows this priority:

    1. PacContext.OrgInfo.OrgUrl already set → authenticate in VS Code
    2. PAC CLI has active auth → sync to PacContext, then authenticate in VS Code
    3. Neither → show org URL input box (existing behavior)
  • Constants.ts: Added ACTIONS_HUB_AUTH_SYNCED_FROM_PAC_CLI telemetry event

  • CreateNewAuthProfileHandler.test.ts: 8 new tests covering sync success, PAC CLI failures, org fetch failures, and fallthrough to existing flow

export const syncAuthFromPacCli = async (pacWrapper: PacWrapper): Promise<boolean> => {
    const pacActiveAuth = await pacWrapper.activeAuth();
    if (pacActiveAuth?.Status === SUCCESS) {
        const authInfo = extractAuthInfo(pacActiveAuth.Results);
        if (authInfo.OrganizationFriendlyName) {
            // Also fetch org info if available
            PacContext.setContext(authInfo, orgInfo);
            return true;
        }
    }
    return false;
};

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node node_modules/gulp/bin/gulp.js testDesktopInt (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI and others added 2 commits April 8, 2026 07:07
…ut box

When the user clicks Login in Actions Hub but PacContext hasn't been
populated yet, the handler now checks PAC CLI directly for an active
auth profile before falling back to showing the "enter environment URL"
input box. This prevents the confusing "auth profile not found" prompt
when the user has already authenticated via PAC CLI.

Agent-Logs-Url: https://github.com/microsoft/powerplatform-vscode/sessions/c26b8917-62e6-4e1c-a2d0-39b52ddf5cb5

Co-authored-by: amitjoshi438 <54068463+amitjoshi438@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix auth profile not found issue in Power Pages CodeQL Sync PAC CLI auth state before showing "auth profile not found" prompt Apr 8, 2026
Copilot AI requested a review from amitjoshi438 April 8, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to Scan Power Pages Code using CodeQL in VS Code as Sites are not loading under power pages actions due to auth profile not found

2 participants