The error AADSTS54005: OAuth2 Authorization code was already redeemed, please retry with a new valid code or use an existing refresh token occurs during the Microsoft Entra ID token issuance step for the Azure Virtual Desktop client, not inside the VM itself. It indicates a problem in the sign‑in/token flow for that user rather than with the AVD host configuration.
From the provided context, the closest documented guidance for similar token‑issuance errors is the AADSTS50000 article, which highlights that such errors are typically caused by issues with the user account, token request parameters, or consent.
Based on that guidance, apply these checks for the affected Entra ID user and the AVD client app:
- Verify the user account and password
- Ensure the user’s password is valid and not expired.
- If the account is synchronized from on‑premises Active Directory, reset the password and confirm that the user can sign in successfully to other Microsoft Entra–protected apps (for example, the Azure portal or Outlook on the web).
- This aligns with the documented guidance that expired/invalid passwords or revoked sessions can cause token issuance failures.
- Clear cached tokens and retry with a fresh sign‑in
- On the client device, sign out of the Windows App / browser session completely.
- Clear browser cookies and site data for
login.microsoftonline.com and aad.portal.azure.com.
- Close and reopen the AVD client or browser and initiate a new sign‑in so that a new authorization code is generated and redeemed only once.
- Check for session or consent issues for the AVD application
- In the Microsoft Entra admin center, under Enterprise applications, locate the Azure Virtual Desktop–related service principals.
- Confirm that the user is allowed to sign in and that no policy is blocking user consent or access for that app.
- The AADSTS50000 guidance recommends verifying that the client application (service principal) exists and that user consent is allowed when token issuance errors occur.
- Revoke existing sessions and force a clean token flow
- If the problem persists only for this user, revoke their existing sign‑in sessions so that all refresh tokens are invalidated and a completely new authorization flow is required.
- This addresses scenarios where a previous session or token state is causing repeated failures.
- Validate that VM‑side Entra sign‑in prerequisites are met (already mostly done)
- The user has
Virtual Machine Administrator Login at the resource group scope, which satisfies the documented requirement that a VM‑sign‑in role be assigned.
- AADLoginForWindows is installed and local admin sign‑in works, which matches the documented prerequisite that the extension must be successfully deployed.
- No per‑user MFA is enforced and no Conditional Access policies are blocking sign‑in, which aligns with the guidance that VM sign‑ins do not support per‑user enabled/enforced MFA.
If, after resetting the password, clearing cached tokens, and revoking sessions, the user can sign in to other Entra‑protected apps but still cannot obtain a token for AVD, collect the full error details (request ID, correlation ID, timestamp) from the error page and open a support case so that the token acquisition request for the AVD client can be reviewed in the Entra sign‑in logs.
References: