Skip to content

[Bug] AADSTS65002 when adding SQL Server Data Source #339

@rmorales87atx

Description

@rmorales87atx

Describe the bug

In a GCC moderate environment, pac / npm CLI commands that enumerate SQL connector data sources (pac code list-datasets / add-data-source -a shared_sql) fail with AADSTS65002 (first-party preauthorization). In the same environment, auth profile, and CLI session, Dataverse table and Power Automate flow operations via the CLI succeed. Only the SQL/connector-runtime path is failing.

App IDs in the error:

  • Client 9cee029c-6210-4654-90bb-17e6e9d36617 = Power Platform CLI
  • Resource d93420f9-abc8-46b7-b7fc-30ec1f007ee2 = connector-runtime/connectivity API
    (the only first-party resource not preauthorized for the PAC app in this GCC tenant)

Steps to Reproduce

  1. pac auth create --cloud UsGov --environment <GCC env> as an interactive
    user (not service principal). Profile works: Dataverse + flow CLI ops succeed.
  2. Create a SQL Server connection using an on-premises Data Gateway
    (Windows Authentication, application service account).
  3. pac code list-datasets -a shared_sql -c <connectionId>
  4. Observe AADSTS65002.

Expected behavior

pac code list-datasets returns available datasets for the SQL connection,
consistent with Dataverse/flow CLI operations succeeding in the same profile.

Actual behavior

Fails immediately with AADSTS65002; the CLI never reaches the connector. Auth is correct and not the cause: --cloud UsGov is the correct value for GCC moderate, identity is an interactive user, and Dataverse + flow CLI operations work in the same auth profile/environment. Only the connector-runtime token request (resource d93420f9-...) is rejected. Reproduces identically on the VS Code-bundled pac 2.6.4 and the current standalone npm CLI 1.1.3.

Screenshots or Error Messages

Error: AADSTS65002: Consent between first party application
'9cee029c-6210-4654-90bb-17e6e9d36617' and first party resource
'd93420f9-abc8-46b7-b7fc-30ec1f007ee2' must be configured via preauthorization
- applications owned and operated by Microsoft must get approval from the API
owner before requesting tokens for that API.
Trace ID: 8c63a7c9-7f94-4ffa-88f1-bb7973a40500
Correlation ID: bca5fde0-8068-41dd-ba89-47465a1096ee
Timestamp: 2026-05-15 15:45:38Z

Environment information

  • Cloud: GCC (moderate)
  • pac CLI: 2.6.4+ga48832 (bundled with VSCode Power Platform Tools extension)
  • npm @microsoft/power-apps CLI: 1.1.3
  • Node: 24.12.0
  • OS: Windows 11
  • pac auth create: --cloud UsGov, specific environment, interactive user (not SP)
  • Connector: SQL Server via on-premises data gateway, Windows Authentication
    (application service account)

Additional context

Bug seems to be localized to the SQL/connector-runtime path. In the same GCC environment, auth profile, and CLI version:

CLI operation Result
pac auth / Dataverse table add-data-source pass
Power Automate flow operations (list/add) pass
pac code list-datasets -a shared_sql (gateway SQL conn) fail (AADSTS65002)
Non-SQL connector, e.g. add-data-source -a shared_office365users pass

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions