Not able to connect Sharepoint Online site using azure ad client Id and Client Secret

Premita-8819 6 Reputation points
2023-04-12T15:20:45.12+00:00

Hi, We are trying connect SharePoint site using Client Id and Client Secret by Powershell script. We have also provided Site.Selected API permission to the app. Connect-PnPOnline -Interactive -Url https://SiteName.sharepoint.com/sites/SiteTitle

 Grant-PnPAzureADAppSitePermission -AppId 'spcify id of that is created' -DisplayName 'specify name of app that is created' -Site 'https://SiteName.sharePoint.com/sites/Sitetitle' -Permissions Read Connect-PnPOnline -ClientId ****** -ClientSecret "" -Url https://*****.sharepoint.com/sites/ -TenantAdminUrl "https://****-admin.sharepoint.com" this command is not giving any error but we are not able to run any simple command like Get-PnPWeb. Get-PnPWeb giving error "The remote server returned an error: (403) Forbidden.".

Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andy David - MVP 157.7K Reputation points MVP Volunteer Moderator
    2023-04-12T15:26:52.1466667+00:00
    0 comments No comments

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.