Power Platform Command Line Interface: September Update

ShafQat Nizar

We are so happy to share new updates released in Power Platform CLI September update. There are a number of improvements that we want to share with our community to help them unblock, such as stage-and-upgrade solution import, create a developer environment on behalf-of, data import with multiple connections, and such.

Also, I am excited to share that we have integrated Power Fx (low-code language for PowerApps) into our Power Platform CLI. This is just the beginning of this integration.

Please keep sharing your feedback for further improvements.

Power Fx Integration into Power Platform CLI (preview)

In this September release we are introducing a new feature (in PREVIEW) for our developers to experience the power of Power Fx. Imagine that as a developer, you need to do a bulk data update to a Dataverse table but you either perform such operation manually or via the user interface. Now you can reduce the time and complexity of your Dataverse operations by using Power Fx from the command line or via a script.

Image pfx 1

1. Power-Fx REPL (Read-Evaluate-Print-Loop) command

This is an interactive shell for you to try ad-hoc queries, updates, and try different Power Fx expressions.

command: `pac power-fx repl`

Image repl 2

2. Power-Fx Run command (using input file mode containing Power Fx logic)

Here we want to share how a developer can write their Power Fx logic to automate their tasks.  

command: pac power-fx run --file <File Name>

Here is an example of my file (test.txt) containing Power Fx expression, and the result is shown below.

First, I want to query the first record in the Contacts table to understand the structure. Then I wanted to perform a check for value “a” found in string “asdf” and return “X” if found else “Y” as if I want to use comparisons. Lastly, just decided to query Contacts table for all records where column “fullname” contains “FName”. You can take this example and expand on by adding, deleting, or updating records.

First(Contacts)

Result = If( Mid( "asdf",1,1 ) = "a", "X", "Y" )

Filter(Contacts, "FName" in fullname)

Image PFX Run

This feature enables developers to use Power Fx formulas to automate their tasks more efficiently.

We would love to hear from you about this Power-Fx capability in CLI and tell us about different scenarios you would like us to include at https://aka.ms/pac/PowerFx.

If you find bugs or want to have further discussions, please share them at https://aka.ms/PowerFx/Feedback.

Canvas Application

In this release we are providing the ability to list your Canvas application in an environment. Now you can do that using the following command:

pac canvas list

You can also download the Canvas application as a .msapp file. You will need to provide the name of your Canvas application and you can view additional optional parameters using pac canvas download help command. In order to download Canvas application you need to use the below command:

pac canvas download -- name <App Name or App ID>

Image canvas 2

And there you have it. This was frequently asked for in the issue repository.

Data import

In this update, I am happy to announce that we are now providing our professional developers the ability to import data faster into their Power Platform environment by using the --connection-count property. If this parameter is not provided, the default connection count is set to 5.

NOTE: The data import capability is not available in Power Platform CLI when you install it using dotnet tool, so you will need to use it on Windows within either Visual Studio Code extension or by using the MSI Installer. This is because this capability uses .NET framework 4.x.

Image data import

Solution Upgrade

In the earlier releases, we introduced a way to easily upgrade a solution. Traditionally, you would have to first use pac solution import --path <solution-zip-file> --import-as-holding and then use pac solution upgrade --solution-name <solution-name>. This update is reducing the number of steps and saving time to upgrade your solution. Now with this improvement, you no longer need to have multiple steps to upgrade your solution, you can simply use below command:

pac solution import --path <solution-zip-file> --stage-and-upgrade

Image solution upgrade

Create an environment on behalf-of

In the earlier releases, an administrator could only create up to three (3) developer environments (also known as personal environments). Administrators had limited control because they were only able to provision environments for themselves, and they were concerned about proper adherence to the deployment lifecycle process and governance. By keeping administrator control and their concerns in mind, We are now making it easy to govern these developer environments by giving administrators the ability to deploy them on behalf of other users. This can be achieved using the following command, replacing the name of the environment and user as required:

pac admin create --name "DevEnvPACCLI" --type "Developer" --user "snizar@"contoso.onmicrosoft.com"

Image user

We are so excited to get this release out, we hope you enjoy these new capabilities, and we are looking forward to hearing from you. As you try these capabilities out, please continue to provide your feedback at the following location: https://aka.ms/pac/feedback.

Also, don’t forget to join our Monthly Power Platform Pro-Dev Office Hours. You can find more information at https://aka.ms/ProDevCommunity.

Thank you!

0 comments

Discussion is closed.

Feedback usabilla icon