Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Microsoft Ads error AADSTS650052

Fix the AADSTS650052 error when connecting Microsoft Ads by registering the Microsoft Advertising API in your Microsoft Entra ID tenant.

If connecting Microsoft Ads fails with an AADSTS650052 error, your organization's Microsoft Entra ID (formerly Azure Active Directory) needs a one-time setup by an IT administrator. Nothing is wrong with your Primer account. The message may also show invalid_client — this page applies only when AADSTS650052 appears with it. An invalid_client error on its own isn't fixed here; contact support@sayprimer.com.

Why AADSTS650052 happens

Connecting Microsoft Ads asks Microsoft for access to the Microsoft Advertising API. For that, the API must be registered in your organization's Entra ID tenant — a registration Microsoft calls a service principal. Some tenants don't have it, and Microsoft then blocks the connection before it shows a sign-in or consent screen.

The fix is for an administrator to register the Microsoft Advertising API in your tenant, then connect again. It only applies if you sign in to Microsoft Advertising with a Microsoft work account.

What your IT administrator needs

  • An Entra ID account with one of these roles: Global Administrator, Application Administrator or Cloud Application Administrator.

  • The Microsoft Advertising API application ID:

    d42ffc93-c136-491d-b4fd-6f18168c68fd

If you don't have an administrator account, share this page with your IT team.

Fix 1: Sign in to Microsoft Advertising as an administrator

Try this first — it's the quickest fix.

  1. Go to ads.microsoft.com and sign in with the Entra ID administrator account.

  2. If prompted, link your Microsoft Advertising account to that work account.

  3. Accept the permissions Microsoft asks for.

  4. Return to Primer and connect Microsoft Ads again.

Signing in this way can register the Microsoft Advertising API in your tenant automatically. If the error comes back, use Fix 2.

Fix 2: Register the Microsoft Advertising API with Graph Explorer

An administrator registers the service principal directly with Microsoft Graph Explorer.

  1. Go to Microsoft Graph Explorer and sign in with the Entra ID administrator account — in the same tenant you use to connect Microsoft Ads.

  2. Set the request method to POST and the version to v1.0.

  3. Enter this request URL:

  4. In the Request body tab, enter:

  5. Click Run query.

A 201 Created response means the service principal is registered. If Microsoft says it already exists, the API is already registered — skip to connecting again.

Graph Explorer returns a permissions error

The signed-in account hasn't consented to create service principals. In Graph Explorer:

Consent may need administrator approval. Then run the query again.

Registering it with the Azure CLI instead

An administrator who prefers the command line can register it in one command, signed in to the tenant you connect Microsoft Ads with:

Connect Microsoft Ads again

Once the API is registered, go to the Connections page in Primer, click Microsoft Ads and choose Sign in with Microsoft, as described in Microsoft Ads. Sign in with the Microsoft account that has access to your Microsoft Advertising account and approve the permissions.

AADSTS650052 still appears after the fix

Cause
What to do

The API was registered in a different tenant

Register it in the tenant of the account you connect with.

The change hasn't taken effect yet

Wait a few minutes, then connect again.

Your tenant requires admin approval for apps

Ask your administrator to approve the permissions Primer requests.

The service principal already exists

Confirm it's in the right tenant, and ask your administrator to check for policies that restrict app access.

If it still fails, email support@sayprimer.com with a screenshot of the error, roughly when you tried to connect, and whether your administrator completed the fixes above.

Last updated