Install-Module Microsoft.Graph.Identity.DirectoryManagement -Scope AllUsers -Force
Import-Module Microsoft.Graph.Identity.DirectoryManagement
Connect-MgGraph -Scopes "Organization.ReadWrite.All", "Directory.ReadWrite.All"
$orgId = (Get-MgOrganization).Id
Update-MgOrganization -OrganizationId $orgId -OnPremisesSyncEnabled:$false
(Get-MgOrganization).OnPremisesSyncEnabled
# Should return: False