What is Microsoft Power Platform CLI?
Microsoft Power Platform CLI is a simple, one-stop developer CLI that empowers developers and ISVs to perform various operations in Microsoft Power Platform related to:
- Environment lifecycle
- Microsoft Dataverse environments
- Solution packages
- Power Pages
- Code components
- and more...
Use github.com/microsoft/powerplatform-build-tools/discussions to view and submit feedback for PAC CLI.
Install Microsoft Power Platform CLI
There are three ways to install the Power Platform CLI. You can use multiple installation methods on the same computer.
|Install the Visual Studio Code extension
|Windows, Linux, macOS
|Enables use of commands within a PowerShell terminal within Visual Studio Code on Windows 10, Windows 11, Linux, and macOS.
When you install using ONLY this method, by default PAC CLI will only be available within a Visual Studio Code terminal unless you enable PAC CLI in Command Prompt (CMD) and PowerShell terminals for Windows
|Install with .NET Tool
|Windows, Linux, macOS
|Enables use of commands within a PowerShell, CMD, or Bash shell on Windows 10, Windows 11, Linux, and macOS.
This installation method doesn't enable use of pac data or certain pac package commands (deploy and show) that are only available for Windows.
|Install with Windows MSI
|Enables use of commands within a PowerShell terminal within Visual Studio Code on Windows only. You can manage installed versions with this installation method.
The following commands are only available on Windows:
To use these commands on Windows, install Power Platform CLI using either (or both) of these installation methods:
These commands aren't available on Windows if you only install using the .NET Tool.
Check whether Power Platform CLI is already installed
How to determine whether the Power Platform CLI is installed depends on your operating system.
Open a PowerShell terminal:
Get-Command pac | Format-Listat the prompt, and press Enter.
The results should look something like this:
Name : pac.exe
CommandType : Application
Definition : C:\Users\you\.dotnet\tools\pac.exe
Extension : .exe
Path : C:\Users\you\.dotnet\tools\pac.exe
FileVersionInfo : File: C:\Users\you\.dotnet\tools\pac.exe
FileDescription: Microsoft Power Platform CLI
Product: Microsoft Power Platform©
Language: Language Neutral
When Power Platform CLI isn't installed, you'll get this error:
Get-Command: The term 'pac' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Check which version of Power Platform CLI is installed
Open the command prompt (on Microsoft Windows), or a Terminal session (in Linux), type
pac and press Enter.
You should see something like this where the version is on the second line.
Microsoft PowerPlatform CLI
Manage auth profiles
Most PAC CLI commands require authenticated access to resources. You'll need to create and use auth profiles.
With the Visual Studio Code extension, you can view and manage authentication profiles.
Connect to your tenant
Use the pac auth create command to connect to your tenant. Running
pac auth create creates an authentication profile on your machine. You can have multiple authentication profiles available. Having multiple authentication profiles is interesting when you work with multiple tenants. For instance, when your company uses multiple tenants (for development, production, and test) or when you're a consultant that works for multiple customers.
pac auth create command has a couple of helpful parameters:
--environmentparameter enables you to automatically connect to the right environment. If you omit the
--environmentparameter, you're connected to the default environment, but with the
--environmentparameter added to it, you can connect to a different one. You can use the environment ID, url, unique name, or partial name as the value.
In environments where you don't have the ability to use an interactive experience, adding the
--deviceCodeparameter makes sure you can still connect. For example, in GitHub Codespaces, the
--deviceCodeparameter automatically gets added when you run
pac auth create.
To connect to the
HR-Dev environment, you can use the following example:
pac auth create --environment "HR-Dev"
Switch to another authentication profile
pac auth list command lists all authentication profiles on your machine. The
pac auth select command selects a different command.
pac auth list Example
To list all authentication profiles, use the following example:
pac auth list
pac auth list command returns all authentication profiles:
Index Active Kind Name Friendly Name Url User Cloud Type
 * UNIVERSAL Personal Productivity (Default) https://x.crm.dynamics.com/ email@example.com Public User
Select a different authentication profile using the index value.
pac auth select --index 2
US Sovereign cloud availability
Microsoft Power Platform CLI is available for use in the GCC and GCC High (US Sovereign cloud) regions. See the
--cloud parameter for the pac auth create command to find out about supported US Sovereign cloud environments.
Learn about the commands. For the complete list of supported commands, run the
pac help command or
pac <subcommand> help - for example:
pac solution help.
Or view the list of commands in the documentation: