SharePoint Online: How to Disable the Power Automate in Lists and Libraries?

Requirement: Disable the “Automate” button in SharePoint Online.

Microsoft Flow is a great tool for automating business processes by building workflows. In some cases, to take control over customization, You may want to disable Flows by hiding the “Automate” button in modern lists and libraries in SharePoint Online.

disable flow sharepoint online

How to Disable Power Automate (Microsoft Flow) in SharePoint Online?

There is no way to disable the Power Automate Out-of-the-box through the browser, but we must use PowerShell to achieve it! Assuming you have the latest SharePoint Online Management Shell installed on your machine, here is how to disable or enable Flow in SharePoint Online site collection via SharePoint Online Management Shell:

#Set parameter values
$AdminSiteURL="https://crescent-admin.sharepoint.com/"
$SiteURL="https://crescent.sharepoint.com/"

#Connect to SharePoint Online Admin Site
Connect-SPOService -Url $AdminSiteURL -Credential (Get-Credential)

# Disable flows on a site collection
Set-SPOSite -Identity $SiteURL -DisableFlows Disabled

#To Enable, use: 
#Set-SPOSite -Identity $SiteURL -DisableFlows NotDisabled

This turns off the “Automate” on all the lists and libraries for the site collection.

turn off flow sharepoint online

However, on Group-connected sites, I see it’s failing with “Set-SPOSite : https://crescent.sharepoint.com/sites/Purchase is a Groups site collection.”

Disable Flow on SharePoint Online Site Collection using CSOM:

Instead of SharePoint Online Management Shell, we can also utilize CSOM scripts to turn off flow in SharePoint Online.

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.Online.SharePoint.Client.Tenant.dll"

#Set parameter values
$AdminSiteURL="https://crescent-admin.sharepoint.com/"
$SiteURL="https://crescent.sharepoint.com/"

$Cred= Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
 
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($AdminSiteURL)
$Ctx.Credentials = $Credentials

#Get the tenant object 
$Tenant = New-Object Microsoft.Online.SharePoint.TenantAdministration.Tenant($ctx)

#Get the current Settings for flow
$SiteColl=$Tenant.GetSitePropertiesByUrl($SiteURL, $true)
$ctx.Load($SiteColl)
$ctx.ExecuteQuery()
$SiteColl.DisableFlows

#Disable/Enable Flow
$SiteColl.DisableFlows = [Microsoft.Online.SharePoint.TenantAdministration.FlowsPolicy]::Disabled #To enable, set:  NotDisabled
$SiteColl.Update()
$Ctx.ExecuteQuery()  

This disables Microsoft Flow for all lists and libraries in a given SharePoint Online modern site. All your existing Flows will work as usual, but you no longer see that button in the interface. You can still start Flow through the waffle, however!

Disable Automate on a Site (Sub-Site):

The above methods disable Microsoft flow for the entire site collection. In some cases, you may want to disable Microsoft flow on a particular subsite. Here is my PowerShell script to disable Microsoft Flow on a particular site.

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Set parameter values
$SiteURL="https://crescent.sharepoint.com/"

#Get Credentials to connect
$Cred= Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
  
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = $Credentials
 
#Disable flow on the Web (Root Web!)
$Web = $Ctx.Web
$Ctx.Load($Web)
$Ctx.ExecuteQuery()

#Disable Flow
$Web.DisableFlows= $true
$Web.Update() 
$Ctx.ExecuteQuery()

Disable Power Automate using PnP PowerShell

#Set Variables
$SiteURL = "https://crescent.sharepoint.com/sites/Sales"
 
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential) 

#disable Microsoft Flow
Set-PnPSite -DisableFlows $True
You can also remove Flow Licenses from users in the Office 365 Admin Panel to restrict them from creating Flows!

Conclusion

Following these steps, you can disable Power Automate for a specific site collection in SharePoint Online. This can be useful for organizations that want to limit the use of Power Automate or ensure that users are following specific business processes when automating workflows in SharePoint Online. It is important to note that deactivating Power Automate will not delete any existing flows that have already been created. However, users will no longer be able to create new flows or access existing flows from within SharePoint Online.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “SharePoint Online: How to Disable the Power Automate in Lists and Libraries?

  • As for now, February 2023, Microsoft seems to have disabled this option. You can still set the parameters using the PnP or SPO Module, but they won’t have any effect. The flow button is still there. Same goes for the Power Apps and the parameter ‘-DisableAppViews’.

    https://learn.microsoft.com/en-us/powershell/module/sharepoint-online/set-sposite?view=sharepoint-ps#-disableflows

    Reply
  • Group connected site cannot set this using the default command or CSOM. Here is the way I found that works.

    $cre = Get-Credential
    Connect-PnPOnline –Url https://contoso-admin.sharepoint.com/ -Credentials $cre
    $sites=Get-pnptenantsite
    Foreach ($site in $sites){
    Connect-PnPOnline –Url $site.url –Credentials $cre
    $ctx = Get-PnPContext
    $ctx.Site.DisableFlows = $true;
    $ctx.ExecuteQuery();
    Write-host “completed on $($Site.URL)”
    }

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *