Can't connect to Connected Services Authentication with Azure Active Directory


I'm trying to connect to the Connected Service "Authentication with Azure Active Directory" but Visual Studio throws an error when I click it.

Connected Services
The Connected Services component 'Azure AD Authentication' failed: (HRESULT:0x80004002) 
Specified cast is not valid.

The error seems to be application specific as I can access it from another application on my system, just not this one. I can't find anything talking about this error anywhere. Does anyone have any idea what could cause this?

The application is a .NET core 2.2 razor pages app.

asked on Stack Overflow Oct 23, 2019 by Carl

1 Answer


I tried to repro it with the current VS version that I have (16.3.6) and was able to configure the said connected service without any issues.

I'd suggest you verify the configured authentication settings to check if everything looks as expected, as this is definitely not an issue with the Project Type. Also consider updating your VS installation to the latest one available.

If the issue still persists, please provide feedback about this behavior with Azure Active Directory here, and/or open an issue with the Visual Studio Team here.

User contributions licensed under CC BY-SA 3.0