Hello AM91,
Thank you for contacting Microsoft Support!
To restrict access to a specific SharePoint site using Microsoft Graph APIs, you can follow these steps:
Use Sites.Selected Permission:
In case if you are trying to site information without signed in user (Application permission), you need to create two app registrations. First Application will have Sites.FullControl.All permission and second Application will have Sites.Selected permission.
Using first application you can make POST call with second application details in request body. You can perform the above operations in postman.
POST https://graph.microsoft.com/v1.0/sites/{site-id}/permissions
Content-Type: application/json
{
"roles": ["read"],
"grantedToIdentities": [
{
"application": {
"id": "your-app-id",
"displayName": "Your App Name"
}
}
]
}
Please note following above steps target application can access entire site collection.
Please refer to below documentations.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.