-
Notifications
You must be signed in to change notification settings - Fork 388
Description
Reporting an Issue or Missing Feature
After updating PnP.PowerShell to 2.12.0 we are facing issue with connecting to SharePoint Site Collection via Credentials.
We tried with 2 App Registration registered with -Interactive (Delegated API Permissions SharePoint: Sites.FullControle) and -DeviceLogin (Delegated API Permissions Site Collection: Sites.Read.All).
Expected behavior
I'm able to login to Site Collection via the following command using ENTRAID_APP_ID - Registered app has Full Control to Site Collections:
Connect to Site Collection:
$env:ENTRAID_APP_ID = 'c153345d-dc75-4feb-922b-d621219e60cf'
$saLogin = 'saLogin@test.com'
$saPswd = 'xxx'
$url = 'https://domain.com/sites/devicedevlearning'
$username = $saLogin
$password = $saPswd | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $password)
Connect-PnPOnline -Url $url -Credentials $credential
Actual behavior
I'm getting the following error:
For App registered using -Interactive:
Connect-PnPOnline: A configuration issue is preventing authentication - check the error message from the server for details. You can modify the configuration in the application registration portal. See https://aka.ms/msal-net-invalid-client for details. Original exception: AADSTS7000218: The request body must contain the following parameter: 'client_assertion' or 'client_secret'. Trace ID: a7c38ef4-41e7-4a2f-8404-bb3529020e00 Correlation ID: d914b76d-3285-4479-8b55-9b07083b4c35 Timestamp: 2024-09-24 12:11:49Z
For App registered as DeviceLogin and having Read permissions to Site Collection and user was consented
'The user or administrator has not consented to use the application with ID '9ac60f00-e392-438a-90a2-897d698bc55e' named 'learning-ci-app'.'.
Steps to reproduce behavior
Register app by manual provided on site and run the following script:
$env:ENTRAID_APP_ID = 'c153345d-dc75-4feb-922b-d621219e60cf' # Interactive
$env:ENTRAID_APP_ID = '9ac60f00-e392-438a-90a2-897d698bc55e' # DeviceLogin
$saLogin = 'saLogin@test.com'
$saPswd = 'xxx'
$url = 'https://domain.com/sites/devicedevlearning'
$username = $saLogin
$password = $saPswd | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $password)
Connect-PnPOnline -Url $url -Credentials $credential
What is the version of the Cmdlet module you are running?
PnP.PowerShell 2.12.0 and also tried 2.12.9
Which operating system/environment are you running PnP PowerShell on?
- Windows