Skip to content

Feature Request: Device Code authentication flow for Power Apps CLI #311

@TuongDoan

Description

@TuongDoan

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:

  1. Display a URL (https://microsoft.com/devicelogin) and a one-time code
  2. Wait for the user to complete sign-in on another device/browser
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestin the backlogThe issue is in the backlog for product team to fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions