If you have been building Power Apps Code Apps with the pac code commands, there is a new CLI you should know about.

The power-apps npm CLI is the recommended path going forward, and the pac code commands are on the deprecation list.

Lets look at what changed and when to switch.

  • The new CLI is power-apps, shipped as part of the @microsoft/power-apps npm package (version 1.0.4 and later).
  • You run it from your project folder with npx power-apps <command>. No global install required.
  • Per the official docs, this CLI replaces the Power Platform CLI’s pac code commands, which are deprecated in a future release (see the npm CLI quickstart).

Why Two CLIs?

The two CLIs cover different scopes. Once you know that, the split makes sense.

  • pac is the broad Power Platform CLI. It handles solutions, environments, Dataverse schema, plugins, PCF, portals, and canvas/model-driven apps. It is not going away.
  • power-apps is focused only on Code Apps. It ships as an npm package so it fits the React or Vite dev loop.

Command Mapping

Here is what maps to what for the core code-app workflow.

TaskOld (pac code)New (power-apps)
Initialize a code apppac code initnpx power-apps init
Run local dev serverpac code runnpx power-apps run
Publish to environmentpac code pushnpx power-apps push
Add a Power Automate flow(not available)npx power-apps add-flow
List flows in environment(not available)npx power-apps list-flows
Sign inpac auth createnpx power-apps login
Check active accountpac auth listnpx power-apps auth-status
Sign outpac auth clearnpx power-apps logout

  • Two things stand out from that table.
    • First, the flow commands (add-flowlist-flowsremove-flow) are only in the new CLI. If you want to call a Power Automate flow from your code app, you need power-apps.
    • Second, the two CLIs have separate auth caches. Signing in to one does not sign you in to the other.

Summary

The power-apps npm CLI is the new recommended tool for Power Apps Code Apps. It ships with the client library. It adds features pac code never had, like Power Automate flow integration. And it fits the Node and Vite dev loop. Pick one CLI per project and stick to it.

📖 Official documentation: Quickstart with npm CLI (preview)

🙂

Leave a Reply

Discover more from Rajeev Pentyala – Technical Blog on Power Platform, Azure and AI

Subscribe now to keep reading and get access to the full archive.

Continue reading