grahamr975 / EWS-Office365-Contact-Sync

Uses Exchange Web Services to synchronize a Global Address List in Office 365 to a user's mailbox
MIT License
96 stars 21 forks source link

"The account does not have permission to impersonate the requested user." #18

Closed dmaglinte77 closed 4 years ago

dmaglinte77 commented 4 years ago

Good afternoon.

I keep running into this issue no matter what user I use. And they're all global admins. It errors out while it's trying to create a new folder. Can you offer some assistance? Thanks!

VERBOSE: Loading module from path 'C:\Scripts\EWS-Office365-Contact-Sync-master\EWSContacts\Module\bin\Microsoft.IdentityModel.Clients.ActiveDirectory.dll'. PS>TerminatingError(Get-EXCContactFolder): "Exception calling "Bind" with "2" argument(s): "The account does not have permission to impersonate the requested user."" VERBOSE: Phone not found, attempting to create now... 2020/08/21 15:39:08 FATAL Failed verify that Phone exists for xyz@xyz.org Exception calling "Save" with "1" argument(s): "The account does not have permission to impersonate the requested user." PS>TerminatingError(Write-Log): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed verify that Phone exists for xyz@xyz.org"

TerminatingError(Write-Log): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed verify that Phone exists for xyz@xyz.org" TerminatingError(Write-Log): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed verify that Phone exists for xyz@xyz.org" TerminatingError(Write-Log): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed verify that Phone exists for xyz@xyz.org" 2020/08/21 15:39:08 ERROR Failed to Sync-ContactList for xyz@xyz.org Failed verify that Phone exists for xyz@xyz.org

Juergen100 commented 4 years ago

Hi dmaglinte77, global admin is not enough. The account need to be add to the management role "ApplicationImpersonation".

https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-configure-impersonation

grahamr975 commented 4 years ago

Exactly what @Juergen100 said... You need to specifically configure ApplicationImpersonation for the account. Closing this ticket...