I have created an Azure AD App, with permission provided for SharePoint as per below screenshot
Using below command to connect
Connect-PnPOnline -AccessToken $AAd_AccessToken -Url https://tenant-admin.sharepoint.com -ReturnConnection -Verbose
I am able to connect and getting context back, however any command running after this failed to execute with below error
PS C:\Windows\system32> Get-PnPWeb
Get-PnPWeb : The remote server returned an error: (401) Unauthorized.
At line:1 char:1
Same is not case with any normal SharePoint site, apart from the admin center / Tenant URL.
Expected behavior
Get-PnPWeb should work the way it works for normal sites e.g. as below
PS C:\Windows\system32> Connect-PnPOnline -AccessToken $AAd_AccessToken -Url https://tenantname.sharepoint.com/sites/Baba
PS C:\Windows\system32> Get-PnPWeb
Title ServerRelativeUrl Id
Baba /sites/Baba 9417b847-39be-45ae-8309-***
Actual behavior
Steps to reproduce behavior
Register Azure AD App, with the permissions mentioned in the issue details
Use below command to connect to SharePoint online
Connect-PnPOnline -AccessToken $AAd_AccessToken -Url https://tenant-admin.sharepoint.com -ReturnConnection -Verbose
Which version of the PnP-PowerShell Cmdlets are you using?
PnP PowerShell for SharePoint Online
What is the version of the Cmdlet module you are running?
3.21.20 SharePointPnPPowerShellOnline..
How did you install the PnP-PowerShell Cmdlets?
Installed through the PowerShell Gallery with Install-Module
Reporting an Issue or Missing Feature
I have created an Azure AD App, with permission provided for SharePoint as per below screenshot
Using below command to connect Connect-PnPOnline -AccessToken $AAd_AccessToken -Url https://tenant-admin.sharepoint.com -ReturnConnection -Verbose
I am able to connect and getting context back, however any command running after this failed to execute with below error PS C:\Windows\system32> Get-PnPWeb Get-PnPWeb : The remote server returned an error: (401) Unauthorized. At line:1 char:1
Same is not case with any normal SharePoint site, apart from the admin center / Tenant URL.
Expected behavior
Get-PnPWeb should work the way it works for normal sites e.g. as below PS C:\Windows\system32> Connect-PnPOnline -AccessToken $AAd_AccessToken -Url https://tenantname.sharepoint.com/sites/Baba PS C:\Windows\system32> Get-PnPWeb
Title ServerRelativeUrl Id
Baba /sites/Baba 9417b847-39be-45ae-8309-***
Actual behavior
Steps to reproduce behavior
Which version of the PnP-PowerShell Cmdlets are you using?
What is the version of the Cmdlet module you are running?
3.21.20 SharePointPnPPowerShellOnline..
How did you install the PnP-PowerShell Cmdlets?