Skip to content

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

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.

Activity

  1. added
    enhancementNew feature or request
    in the backlogThe issue is in the backlog for product team to fix
    and removed
    bugSomething isn't working
    on Apr 10, 2026
  2. eschavez commented on Apr 10, 2026

    @eschavez
    Collaborator

    Thanks for the detailed request, Tuong Doan (@TuongDoan).

    Device code authentication is a valid gap — the old pac auth create --deviceCode flow supported headless and remote environments, and the new @microsoft/power-apps npm CLI currently requires a browser on the same machine.

    This has been added to our backlog. The scenarios you described (SSH sessions, GitHub Codespaces, CI/CD pipelines, restricted desktops) are all use cases we want to support.

    We can't commit to a timeline yet, but your write-up of the proposed UX (--device-code flag or a standalone
    px power-apps auth --device-code command) is helpful context for when we pick this up.

  3. locked and limited conversation to collaborators on Apr 13, 2026
  4. converted this issue into a discussion #315 on Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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