A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
Based on the symptoms and the provided context, this is primarily a Conditional Access/MFA + multi‑tenant sign‑in issue in Visual Studio rather than a generic MFA failure (since MFA works for other Microsoft 365 apps).
Use the following steps focused on Visual Studio’s multi‑tenant/MFA behavior and the Entra account state.
- Clear Visual Studio’s local identity cache
- Close all instances of Visual Studio.
- If any Access to the path 'C:\Users\<UserName>\AppData\Local\.IdentityService\…' is denied errors have appeared, delete the file or directory mentioned in the error under:
-
C:\Users\<UserName>\AppData\Local\.IdentityService\
-
- Before deleting, verify file permissions and ensure the signed‑in Windows user has full control.
- Reopen Visual Studio and retry sign‑in.
- Temporarily filter tenants in Visual Studio (bypass problematic guest tenants)
AADSTS70019 and “The following tenants were not added to the account” indicate problems with one or more associated Microsoft Entra tenants. In Visual Studio (2017/2019):
- Sign out of the affected account in Visual Studio.
- Go to Tools > Options > Accounts.
- Uncheck Authenticate across all Azure Active Directories.
- Sign in again with the same account.
- Visual Studio puts the account into a filtered state.
- Only the default (home) tenant and its resources are available.
- Problematic guest tenants are excluded, which often removes the AADSTS70019 error path and stabilizes MFA.
- Complete MFA in the system browser and keep it open
- When Visual Studio redirects to the system browser and triggers MFA, complete the flow there and keep the browser window open until all CA/MFA policies are validated.
- Closing the browser too early can cause Visual Studio to lose the MFA state and re‑prompt or fail sign‑in.
- Validate the MFA method behavior on the device
Since MFA works for other Microsoft 365 apps, focus on how the notification/OTP is being used:
- For push notifications:
- Ensure the user opens Microsoft Authenticator and checks the pending sign‑in request list. For anomalous or unfamiliar sign‑ins, notifications may not pop; the user must open the app and pull to refresh, then approve the request.
- For OTP (verification code):
- Confirm the user is entering the correct account’s code in Authenticator (multiple accounts can exist in the app). Each account has a unique OATH code.
- Ensure the code is entered immediately (codes rotate every 30 seconds). “Invalid/incorrect” often indicates an expired code or wrong account.
- For push notifications:
- Reauthenticate with tenant selection in Visual Studio
- When Visual Studio shows an account with a “Re-enter your credentials” banner:
- Select Re-enter your credentials.
- In the dialog that lists directories/tenants and AADSTS error codes, deselect any tenant that repeatedly fails.
- Continue sign‑in with the home tenant and any working guest tenants.
- Deselected tenants remain inaccessible until the account filter is removed, but this isolates the failing tenant from Visual Studio sign‑in.
- When Visual Studio shows an account with a “Re-enter your credentials” banner:
- If issues persist
- Capture the exact AADSTS70019 details from the Re-enter your credentials dialog (which tenant(s) fail) and open a Report a Problem / Developer Community ticket from Visual Studio, including:
- Screenshot of the error and tenant list.
- Description of which tenants are required for development.
- This helps investigate tenant‑specific CA/MFA policies that may behave differently for Visual Studio than for standard Microsoft 365 apps.
- Capture the exact AADSTS70019 details from the Re-enter your credentials dialog (which tenant(s) fail) and open a Report a Problem / Developer Community ticket from Visual Studio, including:
Summary of key actions for this scenario
- Clear
.IdentityServicecache if any access issues occurred. - Disable “Authenticate across all Azure Active Directories” and sign in again so only the home tenant is used.
- Use the Re-enter your credentials dialog to deselect failing tenants.
- Complete MFA in the system browser and keep it open until finished.
- Ensure the correct Authenticator account and fresh OTP are used when prompted.
References:
- Sign in to Visual Studio with accounts that require multifactor authentication (MFA)
- Sign in to Visual Studio with accounts that require multifactor authentication (MFA) – Troubleshoot sign in issues
- Sign in to Visual Studio with accounts that require multifactor authentication (MFA) – Reauthenticating an account
- Sign in to Visual Studio with accounts that require multifactor authentication (MFA) – How to opt out of using a specific Microsoft Entra tenant in Visual Studio
- Authentication methods in Microsoft Entra ID - Microsoft Authenticator app