Sharepoint Setup Guide

Purpose

This document outlines the standardized procedure for integrating SharePoint with the Mizo platform. It covers setting up the necessary app registration and configuring permissions to enable secure and restricted access to a specific SharePoint site.

Section 1 – Setting up the base configurations in Mizo

Step 1: Configure Integration in Mizo

  1. Log into the Mizo console.
  2. In the left-hand menu, go to Integrations.
  3. Select SharePoint from the list.

Step 2: Register the App in Microsoft Admin Center

  1. Log into the Microsoft Admin Center using an administrator account.
  2. Navigate to the App Registration page:
    • Go to Show All > All Admin Centers > Microsoft Entra > Apps.
  3. Click + New Registration and fill in the following:
    • Name: Mizo SharePoint Integration
  4. Copy the Tenant ID and Client ID.
  5. Add a Client Secret:
    • Go to Certificates & Secrets.
    • Click + New Client Secret.
    • Copy the Secret Value immediately (it will only be shown once).

Step 3: Assign API Permissions

  1. Go to API Permissions in the app registration.
  2. Click + Add a permission > Microsoft Graph > Application permissions.
  3. Search for Sites.Read.Selected and add it.
  4. Click Grant admin consent to approve the permissions.

Section 2 – Site Configuration

Step 1: Install Microsoft.Graph for PowerShell (https://learn.microsoft.com/en-us/powershell/microsoftgraph/installation?view=graph-powershell-1.0)

  1. Open PowerShell as an Administrator.

  2. Set the execution policy to allow remote scripts:

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
  3. Install the Microsoft.Graph module:

    Install-Module Microsoft.Graph -Scope CurrentUser -Repository PSGallery -Force
  4. This may take a while to complete.

  5. Connect to Microsoft Graph with the required permissions:

    Connect-MgGraph -Scopes "Sites.FullControl.All"

Step 2: Get Site ID & Assign Site Permissions

  1. Replace variables in the following PowerShell script ($siteUrl, $targetAppId, $targetAppDisplayName)

  2. Run to assign site permissions:

    Import-Module Microsoft.Graph.Authentication; `
    Import-Module Microsoft.Graph.Sites; `
    $siteUrl = "https://yourtenant.sharepoint.com/sites/YourSite"; `
    $targetAppId = "Mizo App Client ID"; `
    $targetAppDisplayName = "Mizo App Display Name"; `
    $hostname = ([System.Uri]$siteUrl).Host; `
    $sitePath = ([System.Uri]$siteUrl).AbsolutePath; `
    $siteIdentifier = "$($hostname.Split('.')[0]).sharepoint.com:$sitePath"; `
    try { `
        $site = Get-MgSite -SiteId $siteIdentifier; `
        Write-Host "Site ID: $($site.Id.Split(',')[1])"; `
    } `
    catch { `
        Write-Error "Error getting site: $_"; `
        exit `
    }; `
    $permissionBody = @{ `
        roles = @("read"); `
        grantedToIdentities = @( `
            @{ `
                application = @{ `
                    id = $targetAppId; `
                    displayName = $targetAppDisplayName `
                } `
            } `
        ) `
    }; `
    try { `
        $permission = New-MgSitePermission -SiteId $site.Id -BodyParameter $permissionBody; `
        Write-Host "Permission granted successfully!"; `
        Write-Host "Permission ID: $($permission.Id)"; `
        Write-Host "Roles: $($permission.Roles -join ', ')" `
    } `
    catch { `
        Write-Error "Error granting permissions: $_"; `
        Write-Host "Error details: $($_.Exception.Message)" `
    }; `
    Disconnect-MgGraph

Step 3: Save configuration in Mizo

  1. Go back to the Mizo console.

  2. Enter the Tenant ID, Client ID, and Client Secret.

  3. Paste the Site ID in the corresponding field.

  4. Save the configuration to complete the setup.