AADSTS50011: The redirect URI 'http://localhost' specified in the request does not match the redirect URIs configured for the application

David Tran 0 Reputation points
2026-04-02T20:33:18.57+00:00

Make sure the redirect URI sent in the request matches one added to your application in the Azure portal. Navigate to https://aka.ms/redirectUriMismatchError to learn more about how to fix this.

So how does one know what URL/URI to provide when running locally from PowerShell window?

Microsoft Security | Microsoft Entra | Microsoft Entra ID

2 answers

Sort by: Most helpful
  1. Raja Pothuraju 47,730 Reputation points Microsoft Employee Moderator
    2026-04-09T12:49:37.5066667+00:00

    Hello @David Tran,

    In most cases, this issue is caused by a mismatch between the redirect URI used by the application and the values configured in Microsoft Entra ID App Registration. You may resolve this by reviewing and updating the App Registration using the steps below:

    1. Sign in to the Azure portal using an administrator account for the tenant.
    2. Navigate to Microsoft Entra ID > App registrations.
    3. Select View all applications in the directory, then choose the application whose Application (Client) ID appears in the error message.
    4. From the left‑hand menu, select Authentication.
    5. Under the Redirect URIs section, select Add URI if no redirect URI exists, or edit the existing redirect URI if it is incorrect.
    6. Paste the environment URL exactly as shown in the error message, for example: https://<your-environment>.....com/
    7. Save the changes.

    User's image

    After saving, please allow three to five minutes for the changes to propagate, then attempt to sign in again. If the Microsoft Entra sign‑in page does not appear, try clearing your browser cache or using an InPrivate / Incognito browser session.

    If the redirect URI being sent by the application is not the expected one, you may need to update the application’s code or configuration accordingly.

    For reference, you may review the official Microsoft documentation here: https://learn.microsoft.com/en-us/troubleshoot/entra/entra-id/app-integration/error-code-aadsts50011-redirect-uri-mismatch

    Was this answer helpful?

    0 comments No comments

  2. Rukmini 43,905 Reputation points Microsoft External Staff Moderator
    2026-04-02T20:53:23.6066667+00:00

    Hello David Tran

    Redirect URI mismatch occurs if the Entra app does not have the URI used in PowerShell.

    To fix the issue, try the below:

    • In Entra ID → App Registration → Authentication, add a redirect URI under Public client (native):
      • http://localhost (or specify port if used, e.g., http://localhost:8400)
      • OR https://login.microsoftonline.com/common/oauth2/nativeclient
    • In your PowerShell request, use the exact same URI (including any ports).

    To fix AADSTS50011, register the same localhost/native redirect URI in the application and use it exactly as it in your request.

    Let me know if any further queries - feel free to reach out!

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.