Power Apps CLI environment variables – Power Apps

Environment Connectz1 hour ago3 Views

Use environment variables to configure Power Apps CLI authentication and provide command options in scripts and CI/CD pipelines. Environment variables defined by the Power Apps CLI use the PA_CLI_ prefix.

Note

Environment variables are named values that the operating system makes available to applications. Power Apps CLI recognizes the variables described in this reference. To learn how environment variables work and how to manage them, see about Environment Variables.

This reference describes operating system environment variables that configure the Power Apps CLI. These variables are different from Power Platform solution environment variables, which store configuration values used by an app.

For a command option, the CLI resolves a value in this order:

  1. Command-line option
  2. Environment variable
  3. Default value, if the option has one
  4. Interactive prompt, when supported

An option supplied on the command line takes precedence over its corresponding environment variable.

Important

Environment variables can expose secrets to other processes, logs, or shell history. Store PA_CLI_SP_CLIENT_SECRET in your CI/CD platform’s secret store, mask it from logs, and don’t commit secrets to source control.

Set environment variables

The following examples set PA_CLI_ENVIRONMENT_ID before running a Power Apps CLI command.

$env:PA_CLI_ENVIRONMENT_ID = ""
pa app list

The environment variable remains available to commands started from the same terminal session. Use your shell’s standard command to remove it when it’s no longer needed.

Authentication

Environment variableDescription
PA_CLI_ACCOUNTSpecifies the account for pa auth login or pa auth switch.
PA_CLI_SP_CLIENT_IDSpecifies the Microsoft Entra application (client) ID for service principal authentication.
PA_CLI_SP_CLIENT_SECRETSpecifies the client secret for service principal authentication.
PA_CLI_SP_TENANT_IDSpecifies the Microsoft Entra directory (tenant) ID for service principal authentication.
PA_CLI_USE_SP_AUTHSet the value to true (lowercase) to use service principal authentication.

The three PA_CLI_SP_* credential variables are required when service principal authentication is selected. Although CI=true also selects service principal authentication for compatibility, use PA_CLI_USE_SP_AUTH=true to make the authentication mode explicit.

For setup instructions, see Publish Power Apps code apps with a service principal.

Global command options

These variables correspond to options that are available across Power Apps CLI commands.

Environment variableCorresponding optionDescription
PA_CLI_CLOUD--cloudSelects the target cloud. Valid values are:
public (default)
usgov
usgovhigh
usgovdod
china
Values are case-insensitive.
PA_CLI_ENVIRONMENT_ID--environment-idSpecifies the target Power Platform environment ID.

App initialization

These variables supply options to pa app init.

Environment variableCorresponding optionDescription
PA_CLI_APP_BUILD_PATH--build-pathSpecifies the build output directory. The default is ./dist.
PA_CLI_APP_DESCRIPTION--descriptionSpecifies the app description.
PA_CLI_APP_DISPLAY_NAME--display-nameSpecifies the app display name.
PA_CLI_APP_FILE_ENTRY_POINT--file-entry-pointSpecifies the HTML entry point in the build output. The default is index.html.
PA_CLI_APP_TYPE--app-typeSpecifies the app type. Valid values are:
CodeApp (default)
MobileApp
The value is saved in power.config.json and used as the app type when the app is published.
PA_CLI_APP_URL--app-urlSpecifies the local app URL during pa app init. The value is saved as localAppUrl in power.config.json and becomes the default URL for future pa app run commands. The default is http://localhost:3000.

Run apps

These variables supply options to pa app run.

Environment variableCorresponding optionDescription
PA_CLI_LOCAL_APP_URL--local-app-urlOverrides the localAppUrl value from power.config.json for the current command without changing the saved configuration. If neither value is set, the default is http://localhost:3000.
PA_CLI_PORT--portSpecifies the port for the Power Apps local host. The default is 8080.

Share apps

These variables supply options to pa app share.

Environment variableCorresponding optionDescription
PA_CLI_SHARE_ACCESS--accessSpecifies the access level. Valid values are:
play (default)
edit
PA_CLI_SHARE_PRINCIPAL--principalSpecifies one or more comma-separated email addresses or Microsoft Entra object IDs.

Solutions, connectors, and data sources

Environment variableCorresponding optionDescription
PA_CLI_CONNECTION_DISPLAY_NAME--display-nameSpecifies the display name when creating a connection.
PA_CLI_CONNECTION_ID--connection-idSpecifies a connector connection instance ID.
PA_CLI_CONNECTION_REF--connection-refSpecifies a connection reference logical name.
PA_CLI_CONNECTION_SEARCH--searchFilters results from pa connection list.
PA_CLI_CONNECTOR--connectorSpecifies a connector ID, such as shared_office365users.
PA_CLI_CONNECTOR_SEARCH--searchFilters results from pa connector list.
PA_CLI_DATASET--datasetSpecifies a dataset, such as a SharePoint site or SQL database.
PA_CLI_DATA_SOURCE_NAME--nameSpecifies the data source to refresh or remove.
PA_CLI_ORG_URL--org-urlOverrides the Dataverse organization URL used to retrieve metadata when adding a data source.
PA_CLI_PROCEDURE--procedureSpecifies a SQL stored procedure.
PA_CLI_SOLUTION_ID--solution-idSpecifies the solution for pa app push, pa app add data-source, or pa connection list-references.
PA_CLI_SOLUTION_SEARCH--searchFilters results from pa solution list.
PA_CLI_TABLE--tableSpecifies a table or connector resource name.

For the commands that accept each option, see the Power Apps CLI command reference.

Dataverse APIs and Power Automate flows

Environment variableCorresponding optionDescription
PA_CLI_DATAVERSE_API_NAME--api-nameSpecifies the Dataverse action or function to add with pa app add dataverse-api.
PA_CLI_DATAVERSE_API_SEARCH_TERM--searchFilters Dataverse actions and functions by name with pa app find-dataverse-api.
PA_CLI_FLOW_DATA_SOURCE_NAME--flow-nameSpecifies the flow data source to remove from the app with pa app remove flow
PA_CLI_FLOW_ID--flow-idSpecifies the Power Automate flow to add with pa app add flow.
PA_CLI_FLOW_SEARCH--searchFilters the available Power Automate flows by name with pa app list-flows
PA_CLI_REMOVE_FLOW_ID--flow-idSpecifies the Power Automate flow to remove with pa app remove flow

Telemetry and console output

Environment variableCorresponding optionDescription
PA_CLI_CONSOLE_ONLY--console-onlySet the value to true (lowercase) with pa telemetry enable or pa telemetry disable to write telemetry only to the console and not send it remotely.
PA_CLI_OUTPUT_TO_CONSOLE--output-to-consoleSet the value to true (lowercase) with pa telemetry enable or pa telemetry disable to mirror remotely sent telemetry events to the console.
PA_CLI_TELEMETRYNoneSet one of these values to disable telemetry for the current process:
0
false
no
off
Values are case-insensitive, and surrounding spaces are ignored.

For persistent telemetry settings, see Manage telemetry settings for the Power Apps CLI.

Standard environment variables

The CLI also observes this standard environment variable:

Environment variableDescription
NO_COLORSet this variable to a nonempty value to disable ANSI color output. You can also use the --no-color option.

Connect

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Loading Next Post...
Follow
Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...

css.php