Power Platform CLI: A Game-Changer for Power Platform Development
Power Platform CLI is a simple, one-stop developer command-line interface that empowers developers and ISVs to perform various operations in Microsoft Power Platform related to environment lifecycle, authentication, dataverse environments, solution packages, portals, code components and more1. In this blog, I will show you how to install, update and use Power Platform CLI with different methods and commands.
Installation
You can install Power Platform CLI on Windows, MacOS and Linux devices. The easiest way to install Power Platform CLI, is to install the Power Platform Tools extension for VS Code. This will automatically install the CLI and make it available in the integrated terminal2. For Windows, it’s also possible to install the CLI via a MSI Installer1. Although Power Platform CLI is a cross-platform CLI, some commands only work on Windows. That’s simply because those commands work with tools that haven’t been available cross platform. In the docs on Microsoft Learn, you will see which commands don’t work cross platform1.
Connecting to your Power Platform environment
With the installation done, we are on our way, but we still need to connect to the Power Platform environment to be able to do something with the Power Platform. There are two concepts that you need to be aware of:
- A tenant, this is your own part of the Microsoft Cloud that’s available for your company. Some people work with multiple companies, and they might connect to multiple tenants
- An environment, you can see this as a container inside your tenant which enables you to group data and content you have. This way you can have multiple environments to make split development work from testing and production workloads2
In the Power Platform CLI, you should first connect with the tenant before you can work with the environments. To do that, you can use the pac auth
command group. For example, to create a new connection to a tenant, you can use the following command:
pac auth create --url https://<your-tenant>.crm.dynamics.com
This will open a browser window where you can sign in with your credentials. Once you are authenticated, you can use the pac auth list
command to see all the connections you have created. You can also use the pac auth select
command to switch between different connections2.
To work with an environment, you can use the pac environment
command group. For example, to list all the environments in your tenant, you can use the following command:
pac environment list
This will show you the name, ID, type and URL of each environment. You can also use the pac environment display
command to show the details of the current environment, or the pac environment select
command to switch to a different environment2.
Working with Power Platform components
Once you are connected to an environment, you can use the Power Platform CLI to work with different components of the Power Platform, such as dataverse, solutions, portals, code components and more. Here are some examples of what you can do with the Power Platform CLI:
- To create a new dataverse table, you can use the
pac dataverse table create
command. You can also use thepac dataverse table list
command to list all the tables in your environment, or thepac dataverse table add-field
command to add a new field to a table1. - To create a new solution, you can use the
pac solution init
command. You can also use thepac solution add-reference
command to add a reference to a dataverse table, or thepac solution clone
command to clone an existing solution1. - To create a new portal, you can use the
pac portal create
command. You can also use thepac portal list
command to list all the portals in your environment, or thepac portal export
command to export a portal as a zip file1. - To create a new code component, you can use the
pac pcf init
command. You can also use thepac pcf push
command to push your code component to your environment, or thepac pcf test
command to test your code component in a local web server1.
These are just some of the many commands that you can use with the Power Platform CLI. You can find the full list of commands and their documentation on Microsoft Learn1.
Why use Power Platform CLI?
Power Platform CLI is a powerful tool that can help you streamline your development process and automate your tasks. Here are some of the benefits of using Power Platform CLI:
- You can use Power Platform CLI for both inner loop and outer loop development. The inner loop is for when a developer wants to work on a project and build a new feature for instance. The outer loop is to make sure that what has been built, also can be deployed to other environments2.
- You can use Power Platform CLI with different tools and platforms, such as VS Code, GitHub, Azure DevOps, PowerShell, Bash and more. You can also integrate Power Platform CLI with your own scripts and workflows1.
- You can use Power Platform CLI to work with different types of Power Platform components, such as dataverse, solutions, portals, code components and more. You can also use Power Platform CLI to work with different types of Power Platform environments, such as sandbox, production, trial and more1.
- You can use Power Platform CLI to perform various operations in Power Platform, such as creating, updating, deleting, listing, exporting, importing, testing, cloning and more. You can also use Power Platform CLI to perform advanced operations, such as generating data, applying templates, validating solutions, applying patches and more1.
Conclusion
Power Platform CLI is a simple, one-stop developer command-line interface that empowers developers and ISVs to perform various operations in Microsoft Power Platform. In this blog, I showed you how to install, update and use Power Platform CLI with different methods and commands. I also explained why Power Platform CLI is a useful tool that can help you streamline your development process and automate your tasks. I hope you found this blog helpful and informative. If you have any questions or feedback, please feel free to leave a comment below. Thank you for reading!
Source(s)
- Microsoft Power Platform CLI - Power Platform | Microsoft Learn
- Getting Started with the Power Platform CLI | Power Platform Developer Blog
- Microsoft Power Platform CLI - Power Platform | Microsoft Learn
- Getting Started with the Power Platform CLI | Power Platform Developer Blog
- NuGet Gallery | Microsoft.PowerApps.CLI 1.29.11
- Power Platform CLI support for Power Pages | Microsoft Learn
Comments
Post a Comment