The hassle-free way to install the Power Platform PowerShell cmdlets

Hi all

I am a big fan of the PowerShell cmdlets for administering PowerApps and Flow. While the documentation is comprehensive, the install process is a little unclear and I see many people having trouble with it. The main reasons I see are:

  1. Not having administrative access to ones PC
  2. Not having the right PowerShell execution policy set to run the cmdlets
  3. Not having the package manager installed.

However even if you are not an administrator of your PC, you still can install and configure the modules quickly and easily. For the impatient, here are the four steps:

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -scope CurrentUser
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Scope CurrentUser –Force
Install-Module -Name Microsoft.PowerApps.PowerShell -Scope CurrentUser -AllowClobber –Force
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned –Force

If you want a (slightly) more detailed explanation, follow these steps to happiness (I hope!)…

1. Open a PowerShell command prompt window.

2. Check for the NuGet Package Provider. For reference, The PowerApps cmdlets for PowerShell are installed from a NuGet server maintained by Microsoft. We will first make sure that PowerShell is configured to use this server to search for and deploy modules. You can read more about NuGet here.

Paste the command below and [ENTER]

Get-PackageProvider

clip_image002

If you see NuGet listed in the output, and the version is greater then 2.8.5.201, you can move to step 4.

3. Install the NuGet Package Provider. Paste the command below and [ENTER]

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -scope CurrentUser

clip_image004

4. Install the PowerApps Administration PowerShell cmdlets. Paste the command below and [ENTER].

Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Scope CurrentUser -Force

clip_image006

5. Install the PowerApps Maker PowerShell cmdlets. Paste the command below and [ENTER].

Install-Module -Name Microsoft.PowerApps.PowerShell -Scope CurrentUser -AllowClobber -Force

clip_image008

Note: This module installs some of the same commands as the administration module. The -AllowClobber suppresses warning messages related to this.

6. Finally, check the execution policy of PowerShell and if necessary, set it to RemoteSigned. Paste the command below and [ENTER]

Get-ExecutionPolicy -Scope CurrentUser

clip_image009

If the command returns “Restricted” as shown in the image above, we need to modify it to RemoteSigned before we can run any commands. Paste the command below and [ENTER]

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned –Force

clip_image011

Note: If you do not have the right PowerShell execution policy installed, you might get the following error when running these cmdlets.

Add-PowerAppsAccount : The ‘Add-PowerAppsAccount’ command was found in the module ‘Microsoft.PowerApps.Administration.PowerShell’, but the
module could not be loaded. For more information, run ‘Import-Module Microsoft.PowerApps.Administration.PowerShell’.
At line:1 char:1
+ Add-PowerAppsAccount
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Add-PowerAppsAccount:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

The reason for this is the default execution policy for PowerShell precludes scripts to be run.

7. Connect to your PowerApps environment(s). Paste the command below and [ENTER].

Add-PowerAppsAccount

When prompted, enter your credentials!

Thats it! You can now administer your environments using the awesomeness of PowerShell.

4 Comments on “The hassle-free way to install the Power Platform PowerShell cmdlets

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.