locked
Migration from IMAP to Office365: BAD User is authenticated but not connected RRS feed

  • Question

  • Trying to migrate old IMAP account to new Office365 account using imapsync:

    imapsync --authmech1 PLAIN --authmech2 PLAIN --authuser1 "migration@domain.tld"  --host1 "oldmail.server" --host2 "outlook.office365.com" --user1 "account_to_be_migrated@domain.tld" --user2 "migration@domain.tld\ID@domain.tld" --password1 "REDACTED" --password2 "REDACTED" --office2

    where:

    - migration@domain.tld admin user in both domains (in Office365 Mailbox_Import permission is granted)
    - ID@domain.tld login credentials for Office365

    and imapsync's logs:

    Host2: connecting and login on host2 [outlook.office365.com] port [993] with user [migration@domain.tld\ID@domain.tld]
    Host2 IP address: 40.101.19.146
    Host2 banner: * OK The Microsoft Exchange IMAP4 service is ready. [QQBNADQAUABSADAAMgAwADIAQwBBADAAMAAyADAALgBlAHUAcgBwAHIAZAAwADIALgBwAHIAbwBkAC4AbwB1AHQAbABvAG8AawAuAGMAbwBt
    AA==]
    Host2 capability before authentication: IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
    Host2: outlook.office365.com says it has CAPABILITY for AUTHENTICATE PLAIN
    Host2 failure: Error login on [outlook.office365.com] with user [migration@domain.tld\ID@domain.tld] auth [PLAIN]: 2 NO AUTHENTICATE failed.
    Host2 info: trying LOGIN Auth mechanism on [outlook.office365.com] with user [migration@domain.tld\ID@domain.tld]
    Host2: success login on [outlook.office365.com] with user [migration@domain.tld\ID@domain.tld] auth [PLAIN]
    Host2: state Authenticated

    ... and later ...

    Read:   5 BAD User is authenticated but not connected.


    • Edited by marianh Tuesday, September 10, 2019 12:21 PM
    • Moved by Perry-Pan Tuesday, October 8, 2019 6:55 AM
    Sunday, September 8, 2019 5:40 AM

Answers

  • Solution:

    • proper CLI arguments for imapsync are: --authuser2 "office365_admin@domain.tld" --user2 "user_to_be_migrated@domain.tld" --office2
    • before that following PS command must be executed Add-MailboxPermission -identity user_to_be_migrated@domain.tld  -user office365_admin@domain.tld -accessrights fullaccess -inheritancetype all

    • Marked as answer by marianh Thursday, September 12, 2019 5:27 AM
    Thursday, September 12, 2019 5:27 AM

All replies

  • Get support from,

    https://imapsync.lamiral.info/#SUPPORT

    Try another method like below,

    https://docs.microsoft.com/en-us/exchange/mailbox-migration/migrating-imap-mailboxes/migrate-other-types-of-imap-mailboxes

    https://docs.microsoft.com/en-us/exchange/mailbox-migration/migrating-imap-mailboxes/csv-files-for-imap-migrations

    As your logs, It seems passwords are not match between migration source and migration destination(O365)

    Check Adsync status whether the passwords has been synced with cloud or not.

    Allow all requested url and IPs from firewall.

    https://docs.microsoft.com/en-us/office365/enterprise/urls-and-ip-address-ranges

    • Proposed as answer by Perry-Pan Monday, September 9, 2019 7:03 AM
    Sunday, September 8, 2019 11:18 AM
  • https://docs.microsoft.com/en-us/exchange/mailbox-migration/migrating-imap-mailboxes/migrate-other-types-of-imap-mailboxes

    https://docs.microsoft.com/en-us/exchange/mailbox-migration/migrating-imap-mailboxes/csv-files-for-imap-migrations

    None of them worked because source IMAP server supports \0 as delimiter between admin account and to_be_migrated account and Office365 cannot handle that character.

    As your logs, It seems passwords are not match between migration source and migration destination(O365)

    Check Adsync status whether the passwords has been synced with cloud or not.


    Migration account was created in cloud not in AD.
    Password is OK, I was able to login to Outlook.
    Sunday, September 8, 2019 4:25 PM
  • Hi marianh,

    As far as I know, it should be not supported to migrate mailbox in this way. The recommended way is to follow the instruction in official article.

    Agree with Udara, you could contact imapsync support.

    We can also export all data to a PST file and then import it to the new mailbox as a workaround.

    Regards,

    Perry


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    • Edited by Perry-Pan Monday, September 9, 2019 7:04 AM
    Monday, September 9, 2019 7:03 AM
  • Hi marianh,

    Just check if there are anything else I can do for you. If the information above is helpful to you, it’s recommended to mark it as answer to close off this thread.

    You can feel free to visit this forum if you encounter issues of Office desktop client.

    Regards,

    Perry


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Tuesday, September 10, 2019 7:39 AM
  • Solution:

    • proper CLI arguments for imapsync are: --authuser2 "office365_admin@domain.tld" --user2 "user_to_be_migrated@domain.tld" --office2
    • before that following PS command must be executed Add-MailboxPermission -identity user_to_be_migrated@domain.tld  -user office365_admin@domain.tld -accessrights fullaccess -inheritancetype all

    • Marked as answer by marianh Thursday, September 12, 2019 5:27 AM
    Thursday, September 12, 2019 5:27 AM
  • So glad to see that your issue has been fixed. Thank you for sharing the update here. Your information will definitely benefit other users a lot!

    Have a nice day!

    Regards,

    Perry


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Thursday, September 12, 2019 6:13 AM
  • Here I will provide a brief summary of this post:

    Issue Symptom:

    when migrating old IMAP account to new Office365 account using imapsync, receive this error:

    5 BAD User is authenticated but not connected.

    (Possible) Cause:

    Incorrect command

    Solution:

    • proper CLI arguments for imapsync are: --authuser2 "office365_admin@domain.tld" --user2 "user_to_be_migrated@domain.tld" --office2
    • before that following PS command must be executed Add-MailboxPermission -identity user_to_be_migrated@domain.tld  -user office365_admin@domain.tld -accessrights fullaccess -inheritancetype all


    • Edited by Perry-Pan Thursday, September 26, 2019 5:41 AM
    Thursday, September 26, 2019 5:41 AM