[BUG] No installed instance of Visual Studio
See original GitHub issueDescribe the bug While running code inside Visual Studio debugger, We basically do:
then the code look like this (will edit code snippet tomorrow)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Authentication;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Core.Pipeline;
using Azure.Identity;
using Azure.Extensions.AspNetCore.Configuration.Secrets;
using Azure.Security.KeyVault.Secrets;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Azure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace AzureKeyVault
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureAppConfiguration(builder =>
{
var proxyUri = new Uri("http://THE_PROXY:443");
var webProxy = new WebProxy
{
Address = proxyUri,
BypassProxyOnLocal = true,
Credentials = CredentialCache.DefaultNetworkCredentials,
};
var httpClientHandler = new HttpClientHandler()
{
SslProtocols = SslProtocols.Tls13 | SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls,
UseProxy = true,
Proxy = webProxy
};
var httpClient = new HttpClient(httpClientHandler);
var azCredentialOptions = new DefaultAzureCredentialOptions();
azCredentialOptions.Transport = new HttpClientTransport(httpClient);
azCredentialOptions.ExcludeAzureCliCredential = true;
azCredentialOptions.ExcludeEnvironmentCredential = true;
azCredentialOptions.ExcludeInteractiveBrowserCredential = true;
azCredentialOptions.ExcludeManagedIdentityCredential = true;
azCredentialOptions.ExcludeSharedTokenCacheCredential = true;
azCredentialOptions.ExcludeVisualStudioCredential = false;
azCredentialOptions.ExcludeVisualStudioCodeCredential = true;
var kvUri = new Uri("https://YOUR_KV.vault.azure.net");
var secretClient = new SecretClient(kvUri, new DefaultAzureCredential(azCredentialOptions), new SecretClientOptions { Transport = new HttpClientTransport(httpClient) });
builder.AddAzureKeyVault(secretClient, new KeyVaultSecretManager());
})
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
We have both a Proxy + 2FA <=== that 2FA is probably a source of issue about this Re enter creds
Expected behavior
Properly indicate that the issue is in Tools > Azure Service Authentication > ...
It would be amazing if it could say the account that was detected, and that sometime Reenter Credentials
is needed
Actual behavior (include Exception or Stack Trace)
Missleading “installation not detected” not giving any leads toward Tools > ....
To Reproduce ==> It worked with 16.8 preview 3.0, beware not to try to repro with it but i could not tell if my account was properly added or not
Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)
- Remove all account
- Try to connect using the
VSCredentials
Environment:
- Name and version of the Library package used: all latest possible version version, we tried stable and preview (eg:
Azure.Identity 1.3.0-beta1
) - Hosting platform or OS and .NET runtime version (
dotnet --info
output for .NET Core projects): all Windows 10 and netcoreapp3.1 - IDE and version : we tried : Visual Studio 16.6.x Visual Studio 16.3.x Visual Studio 16.7.x all impacted mine was on 16.8 preview 3.0 / no error, I
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Thanks - I will close unless you run into this again.
perfect