File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ # This script will grant the Managed Identity the correct permissions to the SharePoint site
2+
3+ # The user running this has to be owner of the SharePoint sitem and be sharepoint admin
4+
5+ # Add the correct 'Application (APP) ID' and 'displayName' for the Managed Identity
6+ $application = @ {
7+ id = " APP ID"
8+ displayName = " APP DISPLAY NAME"
9+ }
10+
11+ # Add the correct role to grant the Managed Identity (read or write)
12+ $appRole = " write"
13+
14+ # Add the correct SharePoint Online tenant URL and site name
15+ # $spoTenant = "miljodir.sharepoint.com"
16+ $spoSite = " SITE ID"
17+
18+ # No need to change anything below
19+ # $spoSiteId = $spoTenant + ":/sites/" + $spoSite + ":"
20+
21+ Import-Module Microsoft.Graph.Sites
22+ Connect-MgGraph - Scope Sites.FullControl.All
23+
24+ # New-MgSitePermission -SiteId $spoSiteId -Roles $appRole -GrantedToIdentities @{ Application = $application }
25+
26+ New-MgSitePermission - SiteId $spoSite - Roles $appRole - GrantedToIdentities @ { Application = $application }
27+
28+ # To check the permissions run the following command
29+ # get-mgsitepermission -siteid $spoSite | format-list
You can’t perform that action at this time.
0 commit comments