# Granting access to all sites using SharePoint API in GCC High tenants

Migrating SharePoint sites in GCC High tenants requires providing Movebot access to the sites. This can be done by using PowerShell with an account that has appropriate permission levels.&#x20;

{% hint style="info" %}
If you do not have experience with PowerShell, consult someone in your organisation who does or have a chat with our team for help.&#x20;
{% endhint %}

1\. Install [PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.5) on your computer and connect to Microsoft Graph GCC High

```powershell
# Install once (current user)
Install-Module Microsoft.Graph -Scope CurrentUser -Force
Import-Module Microsoft.Graph

# Connect to the GCC High cloud
Connect-MgGraph -Environment USGov `
  -Scopes "Application.ReadWrite.All", "AppRoleAssignment.ReadWrite.All", "Directory.Read.All"

# (Optional) confirm cloud
(Get-MgContext).Environment

```

2. Identify your app & SharePoint resource

```powershell
# Your Entra app's CLIENT ID
$appId = "<YOUR-APP-CLIENT-ID>"

# Your app's service principal
$sp = Get-MgServicePrincipal -Filter "appId eq '$appId'"

# SharePoint Online resource SP in M365
$spoSp = Get-MgServicePrincipal -Filter "appId eq '00000003-0000-0ff1-ce00-000000000000'"

```

3. Find the `Sites.FullControl.All` App role on SPO and assign it to your app

```powershell
# Locate the Sites.FullControl.All (application) role
$spoRole = $spoSp.AppRoles |
  Where-Object { $_.Value -eq "Sites.FullControl.All" -and $_.AllowedMemberTypes -contains "Application" }

# Grant that role to your app's service principal
New-MgServicePrincipalAppRoleAssignment `
  -ServicePrincipalId $sp.Id `
  -PrincipalId $sp.Id `
  -ResourceId $spoSp.Id `
  -AppRoleId $spoRole.Id

```

4. Verify the assignment

```powershell
Get-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $sp.Id |
  Where-Object { $_.ResourceDisplayName -match "SharePoint" } |
  Select-Object ResourceDisplayName, AppRoleId, PrincipalDisplayName

```

You should see an assignment referencing SharePoint with an AppRoleId matching `$spoRole.Id`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.movebot.io/platform-guides/sharepoint/granting-access-to-all-sites-using-sharepoint-api-in-gcc-high-tenants.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
