-
Notifications
You must be signed in to change notification settings - Fork 388
Closed
Labels
enhancementNew feature or requestNew feature or requestreproducedIssue reproduced after testingIssue reproduced after testing
Description
Background: My client secret has expired.
Expected behavior
In SharePointPnPPowerShellOnline
, Connect-PnPOnline
will return an error 'Token request failed', with exception details available^ .
^ eg, the slightly unwieldy, but possible:
> [System.IO.StreamReader]::new($Error[0].Exception.InnerException.Response.GetResponseStream()).ReadToEnd()
{"error":"invalid_client","error_description":"AADSTS7000222: The provided client secret keys for app 'xxx' are expired. Visit the Azure portal to create new keys for your app: https://aka.ms/NewClientSecret, or consider using certificate credentials for added security: https://aka.ms/certCreds.\r\nTrace ID: xxxx\r\nCorrelation ID: yyy\r\nTimestamp: 2023-02-14 08:32:27Z","error_codes":[7000222],"timestamp":"2023-02-14 08:32:27Z","trace_id":"xxx","correlation_id":"yyy","error_uri":"https://accounts.accesscontrol.windows.net/error?code=7000222"}
Actual behavior
In PnP.PowerShell
version 1.12.0, Get-PnPList
(and others) will return "Exception has been thrown by the target of an invocation." with no information about what the actual problem is.
Steps to reproduce behavior
Connect-PnPOnline -ClientSecret 'xxxx' -ClientId 'yyyy' -Url https://xxx.sharepoint.com/sites/yyy/'
Get-PnPList
Platform
Name Value
---- -----
PSVersion 5.1.19041.2364
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.2364
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
I guess I can understand getting the access token "lazily" (on the first cmdlet that requires it), but not including any details of the error makes it really difficult to debug problems
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestreproducedIssue reproduced after testingIssue reproduced after testing