I was working on migration and when I tried to create an endpoint I got:
"Error creating endpoint. Looks like you do not have permission".
I tested the communication using the Test-MigrationServerAvailability cmdlets and I got access denied.
Command:
>Test-MigrationServerAvailability -Gmail -ServiceAccountKeyFileData $([System.IO.File]::ReadAllBytes("C:\\Users\\Maykon\\Downloads\\office365migration.json")) -EmailAddress yourgmailsuperuse@contoso.com
The problem was related to the Domain-wide delegation, I added this to the API Scope:
After that, the Endpoint was created with success.