Get-AdminPowerApp fails when authenticating using service principal

FabulousFab 21 Reputation points
2024-06-26T19:53:35.7433333+00:00

I registered an application and added it as a Service Principal according to this guide: https://learn.microsoft.com/en-us/power-platform/admin/powershell-create-service-principal. I then logged in as this service principal.

I am trying to get a list of all Power Apps using the PowerShell command Get-AdminPowerApp. However, it gets a few (in my case 52) and then it fails with:

CreateAppObject : Cannot bind argument to parameter 'AppObj' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\Microsoft.PowerApps.Administration.PowerShell\2.0.180\Microsoft.PowerApps.Administration.Powershell.psm1:9305 char:41
+                 CreateAppObject -AppObj $app
+                                         ~~~~
    + CategoryInfo          : InvalidData: (:) [CreateAppObject], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,CreateAppObject


However, if I log in using a username and a password instead of a service principal it works without issues.

Anyone know why?

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,549 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,582 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.