Search code examples
c#sharepointazure-active-directoryazure-functionspnp.powershell

PnP PowerShell: Bad Request when attempting to create a PnPAzureAD App


When running the following command on PowerShell 7.2: Register-PnPAzureADApp -ApplicationName TestApp -Tenant yourtenant.onmicrosoft.com -Store CurrentUser -Username "yourname@domain.com" -Password (Read-Host -AsSecureString -Prompt "Enter Password")

A bad request error is returned on execution: Register-PnPAzureADApp: {"error":{"code":"Request_BadRequest","message":"A null value was found with the expected type 'Edm.String[Nullable=False]'. The expected type 'Edm.String[Nullable=False]' does not allow null values.","innerError":{"date":"2023-07-31T14:21:28","request-id":"7dbf66db-f159-45dc-b061-7a1dcdc9e323","client-request-id":"7dbf66db-f159-45dc-b061-7a1dcdc9e323"}}}

Does anybody have some insight as to what might be the issue with the command? I am unsure if it is an issue with my environment or some other factor. Any help is appreciated! :)

Following Azure AD App Only Authentication in SharePoint Online using PnP PowerShell and expected to have obtained a certificate that I could use in my Azure-Functions application.


Solution

  • I ended up using a wrong build of PnP.PowerShell, installing the nightly build with: Install-Module PnP.PowerShell -Scope CurrentUser -AllowPrerelease -SkipPublisherCheck Did the trick!