Sharepoint - How to disable "Connect to Teams" banner in SharePoint Online

You need to use /_api/groupsitemanager/HideTeamifyPrompt method to disable the Teamify banner.

You can use it in PnP PowerShell as below:

Connect-PnPOnline -Url "https://tenant.sharepoint.com/sites/TestTeamSite"

$jsonBody = "{'siteUrl':'https://tenant.sharepoint.com/sites/TestTeamSite'}"

Invoke-PnPSPRestMethod -Method Post -Url "/_api/groupsitemanager/HideTeamifyPrompt" 
-Content $jsonBody -ContentType "application/json;odata=nometadata"

Reference - What's new in SPO REST API's

Ensure that you are using the latest PnP PowerShell module or atleast the one after May 2019 release ( v3.9 or higher)


This can be done via PowerShell:

$tenant = "https://tenant-admin.sharepoint.com"
$web = "https://tenant.sharepoint.com/sites/ModernTeam"

Connect-PnPOnline -Url $tenant -SPOManagementShell
$site = Get-PnPTenantSite -Detailed -Url $web
if ($site.DenyAddAndCustomizePages -ne 'Disabled') {
    $site.DenyAddAndCustomizePages = 'Disabled'
    $site.Update()
    $site.Context.ExecuteQuery()
}

Set-PnPPropertyBagValue -Key 'TeamifyHidden' -Value 'True'