In this article, we will be fixing “DeletingCloudOnlyObjectNotAllowed” in Azure AD.

I recently had this error in an Azure AD Connect environment where a user was not properly terminated and resulted in a “DeletingCloudOnlyObjectNotAllowed” error. Working with Azure Support eventually got it working but only after we used the following Powershell commands.

Install-Module -Name ExchangeOnlineManagement

import-Module -Name ExchangeOnlineManagement

Install-Module MSOnline

Install-Module AzureADPreview

Connect-MsolService -Credential $Cred

Connect-AzureAD -Credential $Cred

Get-AzureADUser | Where {$_.DirSyncEnabled -eq $null} | Set-MsolUser -ImmutableId “$null”

Start-ADSyncSyncCycle -PolicyType Initial

Start-ADSyncSyncCycle -PolicyType Delta

Start-ADSyncSyncCycle -PolicyType Delta

This resulted in clearing out the error and no Azure AD Connect errors being present.