Forum Discussion

Paul Bullock's avatar
Feb 01, 2017

Convert On-Prem AD Users from Office 365/Azure AD to In-Cloud accounts

Hi

 

We have currently setup a ADConnect Sync to Office 365, this is working well.

 

We would like to start converting Sync'ed accounts in Office 365/Azure AD to "In Cloud" accounts. Can you advise or does anyone know how we might approach this? Or can point to alternative resources?

 

We need to ensure the accounts in Office 365/Azure AD remain active and usable.

 

Much appreciated

Paul

 

  • I have tested this scenario half a year ago because I have a client who will need the same. Worked out well. Please try this in a lab environment first.

     

    #Requirements: Managed domain, Global Administrator, Domain Admin, Active Directory Users and Computers, AD Connect, PowerShell-modules MSOnline & ADSync

     

    #Connect with MSOL
    $credential = Get-Credential
    Connect-MsolService -Credential $credential

     

    #Check DirSync status
    Get-MSOLCompanyInformation | select DirectorySynchronizationStatus

     

    #Backup all ImmutableIDs of federated users

    Get-MsolUser | select userprincipalname,immutableid | sort userprincipalname | Export-Csv -Path $env:USERPROFILE\Desktop\ImmutableIDs.csv -NoTypeInformation -Force

     

    #Migrate synced user to cloud only
    Step 1: Disable DirSync
    Set-MsolDirSyncEnabled -EnableDirSync $false
    Step 2: Nullify ImmutableID !!! Make sure you add quotation marks to $null
    Set-MsolUser -UserPrincipalName user@domain.com -ImmutableId "$null"
    Step 3: Move nullified users to non-synced OU
    Step 4: Enable DirSync
    Set-MsolDirSyncEnabled -EnableDirSync $true
    Step 5: Force AD Connect sync
    Start-ADSyncSyncCycle -PolicyType Delta

     

    #Revert migration of user
    Step 1: Disable DirSync
    Set-MsolDirSyncEnabled -EnableDirSync $false
    Step 2: Move user to original OU
    Step 3: Put back the ImmutableID of the user
    Set-MsolUser -UserPrincipalName user@domain.com -ImmutableId "ID"
    Step 4: Enable DirSync
    Set-MsolDirSyncEnabled -EnableDirSync $true
    Step 5: Force AD Connect sync
    Start-ADSyncSyncCycle -PolicyType Delta

    • Josh-M's avatar
      Josh-M
      Copper Contributor

      After converting an on-prem user to a cloud user, by nullifying the ImmutableId, has anyone been able to verify that the PowerShell command, whoami, returns AzureAD\username instead of ONPREM\username ?

       

      This is the issue we're currently experiencing and we are concerned with any possible adverse affects it might cause to the AzureAD user object functionality and stability. We're currently not experiencing any visible issues at the moment, however. -Josh

      • Erikc's avatar
        Erikc
        Copper Contributor

        Josh-M I tried looking into this as well, I did receive some information from Microsoft. I still don't know if this causes any issues, it doesn't seem to negatively impact anything in a sandbox environment. Also with one user in a production environment.

         

        "This a known gap, that we're reviewing. Even though you have migrated the user from AD to Azure AD, the onprem SamAccountName is still intact on the user object, among other on-prem AD attributes. As a result, Azure AD picks those details and shows domain/user instead of AzureAD/user. This attribute cannot be modified or cleared through Graph APIs at this point, so there's no way to change the behavior. Please file a UserVoice suggestion on MS Graph for this so that our teams can get the feedback and prioritize it as needed"

         

        Source:

        https://github.com/MicrosoftDocs/azure-docs/issues/38048#issuecomment-528570435

  • sagarleo1's avatar
    sagarleo1
    Copper Contributor

     


    Paul Bullock wrote:

    Hi

     

    We have currently setup a ADConnect Sync to Office 365, this is working well.

     

    We would like to start converting Sync'ed accounts in Office 365/Azure AD to "In Cloud" accounts. Can you advise or does anyone know how we might approach this? Or can point to alternative resources?

     

    We need to ensure the accounts in Office 365/Azure AD remain active and usable.

     

    Much appreciated

    Paul

     



    Okay.., Let me try this one and then I will give you some feedback

  • Brent Ellis's avatar
    Brent Ellis
    Silver Contributor
    You could terminate the account in Active Directory (which would terminate the account in AAD/O365) after forcing a delta sync, then login to O365 admin center and "reactivate" / "undelete" the account and assign it a license (if it doesnt remember the license it had).

    There may be other routes, but I know that should accomplish what you need.
      • Paul Bullock's avatar
        Paul Bullock
        MVP

        Hi

         

        I have tried removing the user and re-adding however, this prompts me for a new password. Is there a way to move the user account from On-Prem AD to Azure AD?

         

        Currently the users i want are using AD Connect, however most of the users do not need full AD accounts just email which is in Office 365. So we want to remove them from the local network only but keep in Azure AD.

         

        Any ideas?

         

        Paul

Resources