{"id":5961,"date":"2021-02-11T05:36:10","date_gmt":"2021-02-11T13:36:10","guid":{"rendered":"https:\/\/officedevblogs.wpengine.com\/?p=5961"},"modified":"2021-11-17T12:39:51","modified_gmt":"2021-11-17T20:39:51","slug":"controlling-app-access-on-specific-sharepoint-site-collections","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/controlling-app-access-on-specific-sharepoint-site-collections\/","title":{"rendered":"Controlling app access on a specific SharePoint site collections is now available in Microsoft Graph"},"content":{"rendered":"<p>One very frequent request we\u2019ve heard over the last couple years is to allow for more granular permissions when it comes to accessing SharePoint with an application.\u00a0 Historically we\u2019ve allowed you to select several levels of access but all at the tenant scope.<\/p>\n<p>We are extremely excited to introduce the first step in providing more flexibility in how you control the access that your Microsoft Graph applications can have when working with SharePoint.\u00a0 This is part of an overall longer-term effort to create a complete feature set that supports different needs for different customers.\u00a0 We believe in solutions that will ultimately unify access management for applications across Microsoft 365.<\/p>\n<p>This first step targets a specific scenario that we have gotten feedback on, namely, enabling Enterprise built applications to access specific known site collections rather than all site collections. This solution is very developer focused and requires engagement from both the application developer and an administrative team comfortable with using the Microsoft Graph API for management.<\/p>\n<p>The feature itself is straightforward. A new permission is available for applications under the Microsoft Graph Sites set of permissions named <strong><em>Sites.Selected<\/em><\/strong>. Choosing this permission for your application instead of one of the other permissions will, by default, result in your application not having access to any SharePoint site collections.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-5962 size-full\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/02\/jeremy-graph-permissions.png\" alt=\"Sites.selected permission in Azure AD\" width=\"936\" height=\"668\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/02\/jeremy-graph-permissions.png 936w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/02\/jeremy-graph-permissions-300x214.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2021\/02\/jeremy-graph-permissions-768x548.png 768w\" sizes=\"(max-width: 936px) 100vw, 936px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>To grant permission for the application to a given site collection, the administrator will make use of the newly introduced site permissions endpoint. Using this endpoint, the administrator can grant Read, Write, or Read and Write permissions to an application.\u00a0 Along with <strong><em>Sites.Selected<\/em><\/strong> this will result in only those sites that have had permission granted being accessible.<\/p>\n<p>For example, if I wanted to grant the Foo application write permission to a single site collection, I would make this call:<\/p>\n<pre class=\"\">POST https:\/\/graph.microsoft.com\/v1.0\/sites\/{siteId}\/permissions\n\nContent-Type: application\/json\n\n{\n\n\u00a0 \"roles\": [\"write\"],\n\n\u00a0 \"grantedToIdentities\": [{\n\n\u00a0\u00a0\u00a0 \"application\": {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0 \"id\": \"89ea5c94-7736-4e25-95ad-3fa95f62b66e\",\n\n\u00a0\u00a0\u00a0\u00a0\u00a0 \"displayName\": \"Foo App\"\n\n\u00a0\u00a0\u00a0 }\n\n\u00a0 }]\n\n}<\/pre>\n<p>For more detailed information about using the API please see the <a href=\"https:\/\/docs.microsoft.com\/graph\/api\/site-get-permission?view=graph-rest-1.0\">Microsoft Graph documentation<\/a>.<\/p>\n<p>See also following demo by <a href=\"https:\/\/twitter.com\/Fizzlenik\">Jeremy Kelley<\/a> (Microsoft) from a recent Microsoft Graph community call for the additional details.<\/p>\n<p><iframe title=\"SharePoint Site Collection Level Permissions\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/wcJRQDsXMQ8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>Over time we will continue to work with the Azure and Microsoft Graph teams to add additional capabilities and support more scenarios.<\/p>\n<p><span style=\"font-size: large\"><em>\u201cSharing is caring\u201d<\/em><\/span><\/p>\n<hr \/>\n<p><i>SharePoint Team, Microsoft &#8211; 11th of February 2021<\/i><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft Graph has now new permission named Sites.Selected, which can be used to control app access on a specific SharePoint site collections.<\/p>\n","protected":false},"author":69078,"featured_media":25159,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3,11,9],"tags":[],"class_list":["post-5961","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-graph","category-office-add-ins","category-sharepoint-framework"],"acf":[],"blog_post_summary":"<p>Microsoft Graph has now new permission named Sites.Selected, which can be used to control app access on a specific SharePoint site collections.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/5961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/users\/69078"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=5961"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/5961\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/25159"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=5961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=5961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=5961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}