Getting started with Microsoft Power Platform CLI

Here, we can learn how to install and how to use Microsoft Power Apps CLI commands to access and manage Microsoft Power Apps components

Now a days, there is lot of opportunities available for Microsoft Power Platform professionals. Because it is not only the Low-code solution platform, in addition to that it also provides the lot of opportunity to developers to extend the Power Platform to unlimited imaginary.

Before any development goes, we need to understand and have the knowledge of how to connect and deploy the developed assets to the environment. For Microsoft Power Platform we have the Power Platform CLI to accomplish this scenario.

To have this Power Platform CLI in our machine, we must require below tools need to be installed. They are,

  1. Node JS (LTS – recommended) and NPM
  2. .NET Framework 4.6.2 Developer Pack
  3. .Net Core 3.1 SDK
  4. Visual Studio Code

We can also go with another by installing Visual Studio with VS 2017 or recent version with the Node JS and .Net Core support

Install Power Platform CLI

  1. Download the Power Platform CLI tools from below location,
    https://aka.ms/PowerAppsCLI
  2. Run the package and install it

Install Power Apps CLI

  1. Once installed, you can also run the below command to install the latest version,
    pac install latest
  2. Type pac command to know the lists of commands available in this CLI

PAC Commands List

Authenticate Microsoft Dataverse

Use the below command to authenticate with Microsoft Dataverse in Power Platform
pac auth create –-url https://org*****.crm.dynamics.com

To get the organization URL from Power Platforms.

  1. Navigate to Power Apps home page
  2. Click Settings menu
  3. Then click Session Details to open the Power Apps session details dialog box
  4. Click Copy Details button and paste it in notepadPowerApps Org URL for Authentication
  5. Then copy the value of Instance Url and from that remove the trailing /

If the command is connected with Microsoft Dataverse, output looks like below,

pac auth create –url https://org***-crm.dynamics.com

pac auth create

To view all solutions available in the environment, run the below command,

pac solution list

pac-solutions

 

If the Organization URL is not correct, we may get the below error messages,

ERROR 1:

Error: Failed to connect to Dataverse
There was no endpoint listening at https://org*******.crm8.dynamics.com/XRMServices/2011/Organization.svc/web?SDKClientVersion=9.0.46.3082 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.Unable to connect to the remote server. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 20.44.34.50:443

ERROR 2:
Error: The browser based authentication dialog failed to complete. Reason: The Internet connection has timed out.

ERROR 3:
Error: The value '*******.crm8.dynamics.com' passed for --url is not a valid URL or Guid.

ERROR 4:
Error: An error occurred while sending the request.
The underlying connection was closed: An unexpected error occurred on a receive.
Received an unexpected EOF or 0 bytes from the transport stream.

ERROR 5:
Error: AADSTS500011: The resource principal named https://*******.dynamics.com/ was not found in the tenant named ******.onmicrosoft.com. This can happen if the application has
not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.
Trace ID: 7c8edfc1-2dad-4a57-829e-8e3298bb7d00
Correlation ID: 4fcab72b-b289-4745-94c8-57de6b6d324e
Timestamp: 2021-05-27 05:00:43Z

To avoid the above erros, follow the steps mentioned in To get the organization URL from Power Platforms. Hope you enjoyed this post and also share your comments.

Shantha Kumar
Shantha Kumar
Articles: 278

24,849 Comments

Comments are closed.