What is Microsoft Power Apps CLI?

Microsoft Power Apps CLI is a simple, single-stop developer command-line interface that empowers developers and app makers to create code components.

Power Apps CLI tooling is the first step toward a comprehensive application life-cycle management (ALM) story where the enterprise developers and ISVs can create, build, debug, and publish their extensions and customizations quickly and efficiently.

Install Power Apps CLI

To get Power Apps CLI, do the following:

  1. Install Npm (comes with Node.js) or Node.js (comes with npm). We recommend LTS (Long Term Support) version 10.15.3 or higher.

  2. Install .NET Framework 4.6.2 Developer Pack.

  3. If you don’t already have Visual Studio 2017 or later, follow one of these options:

  4. Install Power Apps CLI.

  5. To take advantage of all the latest capabilities, update the Power Apps CLI tooling to the latest version using this command:

    pac install latest
    

Note

Currently, Power Apps CLI is supported only on Windows 10.

Common commands

This table lists some of the common commands used in the CLI:

Command Description
pcf Commands to work with Power Apps component framework.
solution Commands for working with Common Data Service solution projects.
auth Commands to authenticate to Common Data Service.
telemetry Manages the telemetry settings.
plugin Manages to create a plug-in project.
org Command to work with Common Data Service environment.

Pcf

Commands to work with Power Apps component framework. It has the following parameters:

Parameters

Property Name Description Example
init Initializes the code component project. It has the following parameters
- namespace: Namespace of the code component.
- name: Name of the code component.
- template: Field or dataset
pac pcf init --namespace<SampleNameSpace --name SampleComponent --template field
push Pushes the code component to the Common Data Service instance with all the latest changes. It has the following parameter:
- publisher-prefix: Publisher prefix of the organization.
pac pcf push --publisher-prefix dev
version Updates the component manifest file with the specified patch version. It has the following parameters:
- patchversion: Patch version of the code component. patchversion will only take value of the third part of the version tuple: Major.Minor.Patch.
- path: Absolute or relative path of the component manifest file.
- allmanifests: Updates the patch version for all the component manifest files.
- updatetarget: Updates the specified manifest file. It has two values, build and project.
- strategy: Updates patch version for the manifest files using specified strategy values. It has the following values:
- gittags: Use git tags to decide if a particular component’s patch version needs to be updated.
filetracking: Use .csv file to decide if a particular component’s patch version needs to be updated.
- manifest: Increments the patch version by 1 for all the components.
pac pcf version --patchversion 1.0.0.0 --path c:\Users\Downloads\SampleComponent --allmanifests

pac pcf version --strategy gittags

Solution

Commands for working with Common Data Service solution projects. It has the following parameters:

Parameters

Property Name Description Example
init Initializes the solution project. It has the following parameters:
- publisher-name: Publisher name of the organization.
- publisher-prefix: Publisher prefix of the organization.
pac solution init --publisher-name developer --publisher-prefix dev
add-reference Sets the reference path to the component project folder by passing the path parameter. pac solution add-reference --path c:\Users\Downloads\SampleComponent
clone Creates a solution project based up on the existing solution project. It has the following parameters:
-name: The name of the solution to be exported.
-targetversion: The version that the exported solution supports.
-include: Settings that should be included in the solution being exported.
It has the following values: autonumbering, calendar, customization, emailtracking, externalapplications, general, isvconfig, marketing, outlooksynchronization, relationshiproles, sales
pac solution clone -–name sampleSolution --version 1.0.0.2 --include general
export Exports a Common Data Service solution project from the current organization. It has the following parameters:
-path: Place where the exported solution zip file will be saved.
- name: Name oft he solution that needs to be exported.
- managed: Defines whether the solution should be exported as a managed solution or not.
-targetversion: The version that the exported solution supports.
-include: Settings that should be included in the solution being exported.
pac solution export --path c:\Users\Documents -- name SampleComponentSolution -- managed true -- targetversion 10.0.03 --include general

Auth

Commands to authenticate to Common Data Service. It has the following parameters:

Parameters

Parameter Name Description Example
create Creates the authentication profile for your organization by passing the url parameter. Pass the organization url for the url parameter. pac auth create --url https://Myorg.crm.dynamics.com
list Provides the list of authentication profiles. pac auth list
select Provides a way to switch between previously created authentication profiles by passing the index parameter. pac auth select --index 2
delete Deletes the authentication profile created by passing the index parameter. pac auth delete --index 2
clear Clears all the authentication profile created on the local machine. pac auth clear

Telemetry

Manages the telemetry settings. It has the following parameters:

Parameters

Parameter Name Description Example
enable Enables the telemetry option. pac telemetry enable
disable Disables the telemetry option. pac telemetry disable
status Returns whether the telemetry is enabled or disabled. pac telemetry status

Org

Command to work with Common Data Service organizations.

Parameters

Parameter Name Description Example
who Displays information about the current Common Data Service organizations. pac org who

Plugin

Manages to create a plug-in project.

Parameters

Parameter Name Description Example
init Initializes a directory with a new plugin class library. pac plugin init

Uninstall Power Apps CLI

To uninstall the Power Apps CLI tooling, run the MSI from here.

If you are a Private Preview participant and have an older version of CLI, follow these steps:

  1. To find out where the Power Apps CLI is installed, open a command prompt and type where pac.

  2. Delete the PowerAppsCLI folder.

  3. Open the Environment Variables tool by running the command rundll32 sysdm.cpl,EditEnvironmentVariables in the command prompt.

  4. Double-click Path under the User variable for... section.

  5. Select the row containing the PowerAppsCLI path and select the Delete button on the right-hand side.

  6. Select OK twice.

See also

Power Apps component framework