Summary
The new @microsoft/power-apps npm CLI (npx power-apps init, npx power-apps push, etc.) currently only
supports interactive browser-based authentication. Please add support for Device Code authentication flow,
similar to pac auth create --deviceCode in the PAC CLI.
Motivation
Device Code flow is essential for scenarios where a browser cannot be opened on the same machine:
- Remote/headless environments — SSH sessions, cloud VMs, GitHub Codespaces, containers
- CI/CD pipelines — automated builds and deployments
- Restricted desktops — environments where browser popups are blocked or unavailable
The old PAC CLI workflow supported this via pac auth create --deviceCode, which displayed a URL and code the user
could enter on any device with a browser. With the new npm-based CLI replacing pac code commands, this
capability is no longer available.
Proposed Solution
Add a --device-code flag to npx power-apps init and any other commands that require authentication:
npx power-apps init --device-code --display-name "my-app" --environment-id <env-id>
This would:
- Display a URL (https://microsoft.com/devicelogin) and a one-time code
- Wait for the user to complete sign-in on another device/browser
- Continue the CLI flow once authentication succeeds
Alternatively, a standalone auth command like npx power-apps auth --device-code that persists credentials for
subsequent commands would also work.
Summary
The new
@microsoft/power-appsnpm CLI (npx power-apps init,npx power-apps push, etc.) currently onlysupports interactive browser-based authentication. Please add support for Device Code authentication flow,
similar to
pac auth create --deviceCodein the PAC CLI.Motivation
Device Code flow is essential for scenarios where a browser cannot be opened on the same machine:
The old PAC CLI workflow supported this via
pac auth create --deviceCode, which displayed a URL and code the usercould enter on any device with a browser. With the new npm-based CLI replacing
pac codecommands, thiscapability is no longer available.
Proposed Solution
Add a
--device-codeflag tonpx power-apps initand any other commands that require authentication:This would:
Alternatively, a standalone auth command like npx power-apps auth --device-code that persists credentials for
subsequent commands would also work.