Hello @Alan Auld,
Based on your description, I understand that you want to completely disable synchronization and you would like to remove the synced users and group from Cloud. To do that you should first convert synced users into cloud-only users without any on-premises attributes and post that you can delete the accounts from cloud. Additionally, you mentioned that you no longer have access to on-premises server as you decommissioned and no longer available.
To proceed with converting synced users into cloud-only users, please follow the steps below using Microsoft Graph Explorer to disable directory synchronization:
- Open Microsoft Graph Explorer.
- Sign in using a Global Administrator account.
- Use the following PATCH request (replace
{organization-id}with your actual Tenant ID):
YAML
PATCH https://graph.microsoft.com/beta/organization/{organization-id} (Replace org id with Tenant ID)
- Navigate to the Modify Permissions tab and grant Organization.ReadWrite.All permission (consent on behalf of the organization).
- In the Request Body, enter the following JSON:
JSON
{
"onPremisesSyncEnabled": false
}
- Click Run Query.
Note: It may take 4–5 minutes for the changes to reflect in the Azure portal. The maximum time to disable directory sync is 72 hours, but it may vary based on the object size.
Once completed, the previously synced users will be converted to cloud-only users. Then if you want to have those users you can keep it like that if not you can delete those users as per your needs.
Alternatively, you can also use PowerShell to disable directory synchronization. Please refer to the official Microsoft documentation below for detailed steps:
Turn off directory synchronization for Microsoft 365
You can use Microsoft Graph PowerShell SDK. This is the modern, unified PowerShell module built on the Microsoft Graph API.
# Install v1.0 and beta Microsoft Graph PowerShell modules
Install-Module Microsoft.Graph -Force
Install-Module Microsoft.Graph.Beta -AllowClobber -Force
# Connect With Hybrid Identity Administrator Account
Connect-MgGraph -scopes "Organization.ReadWrite.All,Directory.ReadWrite.All"
# Verify the current status of the DirSync Type
Get-MgOrganization | Select OnPremisesSyncEnabled
# Store the Tenant ID in a variable named organizationId
$organizationId = (Get-MgOrganization).Id
# Store the False value for the DirSyncEnabled Attribute
$params = @{
onPremisesSyncEnabled = $false
}
# Perform the update
Update-MgOrganization -OrganizationId $organizationId -BodyParameter $params
# Check that the command worked
Get-MgOrganization | Select OnPremisesSyncEnabled
Let me know if you need assistance with any of the steps.