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-appsnpm 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 codecommands, 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.
pacis 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-appsis 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.
| Task | Old (pac code) | New (power-apps) |
|---|---|---|
| Initialize a code app | pac code init | npx power-apps init |
| Run local dev server | pac code run | npx power-apps run |
| Publish to environment | pac code push | npx 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 in | pac auth create | npx power-apps login |
| Check active account | pac auth list | npx power-apps auth-status |
| Sign out | pac auth clear | npx power-apps logout |
- Two things stand out from that table.
- First, the flow commands (
add-flow,list-flows,remove-flow) are only in the new CLI. If you want to call a Power Automate flow from your code app, you needpower-apps. - Second, the two CLIs have separate auth caches. Signing in to one does not sign you in to the other.
- First, the flow commands (
- The two CLIs sign in independently, so a valid
pac authsession does not helpnpx power-appsat all. I hit an authorization error from this exact cause and wrote it up separately here: Power Apps Code Apps –npx power-appsauthorization error, cause and fix.
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