Skip to content

[Bug] AADSTS65002 When Adding SharePoint Data Source via Power Apps CLI #348

@Vulkarin

Description

@Vulkarin

Summary

AADSTS65002 error occurs when using the Power Apps CLI (npx power-apps add-data-source) to connect to SharePoint Online in a GCC environment.

Steps to Reproduce

  1. Clone the vite template
  2. Run npm i
  3. Run npx power-apps init --cloud gccmoderate -e <YOUR_ENV_ID>
  4. Attempt to run npx power-apps add-data-source -a shared_sharepointonline ...

Authentication fails immediately with AADSTS65002.

Error Message

invalid_request: Error(s): 65002 - Timestamp: 2026-05-08 15:19:13Z - Description:
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.
Field Value
Trace ID 0a35eebe-3be4-4f18-ad0e-8f6ef95a4b00
Correlation ID b18df6d0-c3ce-42a9-ac2b-fd3f3289a88a
Timestamp 2026-05-08 15:19:13Z

Expected Behavior

The CLI successfully adds the SharePoint Online data source to the Power Apps Code App.

Actual Behavior

Authentication fails immediately. The command cannot complete, making it impossible to programmatically connect a Power Apps Code App to SharePoint via the CLI in a GCC environment.

Analysis

This appears to be a missing preauthorization between Microsoft's own first-party applications:

  • CLI App: 9cee029c-6210-4654-90bb-17e6e9d36617
  • Target Resource: d93420f9-abc8-46b7-b7fc-30ec1f007ee2

The error explicitly states this is a first-party-to-first-party consent issue that cannot be resolved by the tenant admin — it requires Microsoft to add the preauthorization on their end for GCC cloud environments.

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