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:
Enables use of commands within a PowerShell terminal within Visual Studio Code on Windows only. You can manage installed versions with this installation method.
Bemærk
The following commands are only available on Windows:
When Power Platform CLI isn't installed, you'll get this error:
PowerShell
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.
To see if Power Platform CLI is installed in Linux or macOS, open the Terminal/Command prompt, type which pac at the prompt, and press Enter.
The results should look something like this:
Bash
/home/you/.dotnet/tools/pac
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
Version: 1.30.3+g0f0e0b9
Manage auth profiles
Most PAC CLI commands require authenticated access to resources. You'll need to create and use auth profiles.
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.
The pac auth create command has a couple of helpful parameters:
The --environment parameter enables you to automatically connect to the right environment. If you omit the --environment parameter, you're connected to the default environment, but with the --environment parameter 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 --deviceCode parameter makes sure you can still connect. For example, in GitHub Codespaces, the --deviceCode parameter automatically gets added when you run pac auth create.
Example
To connect to the HR-Dev environment, you can use the following example:
PowerShell
pac auth create --environment"HR-Dev"
Switch to another authentication profile
When you have multiple authentication profiles, you can easily switch using the pac auth list and pac auth select commands.
The 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:
PowerShell
pac auth list
Running the pac auth list command returns all authentication profiles:
PowerShell
Index Active Kind Name Friendly Name Url User Cloud Type
[1] * UNIVERSAL Personal Productivity (Default) https://x.crm.dynamics.com/ user@contoso.onmicrosoft.com Public User
Select a different authentication profile using the index value.
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.
Next steps
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: