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
- Clone the vite template
- Run
npm i
- Run
npx power-apps init --cloud gccmoderate -e <YOUR_ENV_ID>
- 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.
Summary
AADSTS65002error 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
npm inpx power-apps init --cloud gccmoderate -e <YOUR_ENV_ID>npx power-apps add-data-source -a shared_sharepointonline ...Authentication fails immediately with
AADSTS65002.Error Message
0a35eebe-3be4-4f18-ad0e-8f6ef95a4b00b18df6d0-c3ce-42a9-ac2b-fd3f3289a88a2026-05-08 15:19:13ZExpected 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:
9cee029c-6210-4654-90bb-17e6e9d36617d93420f9-abc8-46b7-b7fc-30ec1f007ee2The 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.