When using EWS archiving is not possible. Following error appears:
Access is denied. Check credentials and try again.
Get-Mailbox -ResultSize unlimited -Filter {RecipientTypeDetails -eq 'UserMailbox'} | Add-Mailboxpermission -User admin@company.com -AccessRights fullaccess -InheritanceType all -Automapping $False
If the problem persists, check following KB article and make sure that all required permissions are in place.