@suresh yadaw , @Danstan
I have also tried to use this Get for site permissions in PowerShell and I do get a 200 response but it does not list the permissions like the documentation states. I also need all of the permissions, SharePoint groups, users, and Office 365 groups.
My Azure application does have Sites.FullControl.All and is granted by admin.
I am using the following to connect:
Connect-PnPOnline -Url https://HIDDEN.sharepoint.com/ -ClientId HIDDEN -Tenant "HIDDEN.onmicrosoft.com" -Thumbprint HIDDEN
Then these statements to gather the permissions for the site:
$baererToken = (Get-PnPGraphAccessToken)
$headers = @{ Authorization=("Bearer " + $baererToken) }
$webRequest = Invoke-WebRequest –Uri "https://graph.microsoft.com/v1.0/sites/HIDDEN/permissions" –Method Get -Headers $headers
The following is what is returned and this is also what is returned when I use Graph Explorer:
StatusCode : 200
StatusDescription : OK
Content : {"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#sites('HIDDEN.sharepoint.com%2CHIDDEN%2CHIDDEN')/permissions","value":[]}
RawContent : HTTP/1.1 200 OK
Transfer-Encoding: chunked
Strict-Transport-Security: max-age=31536000
request-id: HIDDEN
client-request-id: HIDDEN
x-m...
Forms : {}
Headers : {[Transfer-Encoding, chunked], [Strict-Transport-Security, max-age=31536000], [request-id,
HIDDEN], [client-request-id, HIDDEN]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 203
Executing the following:
$webRequest = Invoke-WebRequest –Uri "https://graph.microsoft.com/v1.0/sites/HIDDEN" –Method Get -Headers $headers
Actually returns what I would expect for this request.