[BUG] Using Azure AppConfiguration and KeyVault as Configuration failes

Library name and version
Azure.Identity 1.5.0
Describe the bug
When using the libraries Microsoft.Azure.AppConfiguration.AspNetCore (4.5.1) and Azure.Extensions.AspNetCore.Configuration.Secrets (1.2.1) to built an .NET 6.0 Web Api with Azure App Configuration and Azure Key Vault as configuration providers. The Application startup failes either with

Access Token retrieval for Azure Key Vault failes, because the DefaultAzureCredential() instance is requesting a Token with scope for the whole Key Vault URI instead of only https://vault.azure.net/.
Access Token retrieval for the App Configuration failes with an HTTP 400 Bad Request error.

Expected behavior
Using both Configuration Providers should be working with the DefaultAzureCredential.
Actual behavior
Getting described errors in an Azure App Service Environment
Reproduction Steps
public static IHostBuilder ConfigureMyApplication(this IHostBuilder builder, string appName, TokenCredential? credential = null) => builder.ConfigureAppConfiguration((_, config) =>
  {
    config
      .AddEnvironmentVariables()
      .AddJsonFile("appsettings.json", optional: true)
      .AddInMemoryCollection(new Dictionary<string, string>()
      {
        [AppName] = appName
      });

    if (credential != null)
    {
      var built = config.Build();
      var endPoint = built[AppConfig];
      if (!string.IsNullOrEmpty(endPoint) && Uri.TryCreate(endPoint, UriKind.Absolute, out Uri? endpointUri))
      {
        config.AddAzureAppConfiguration(appCfg =>
          appCfg
            .Connect(endpointUri, credential)
            .Select(Microsoft.Extensions.Configuration.AzureAppConfiguration.KeyFilter.Any)
        );
      }

      endPoint = built[KeyVault];
      if (!string.IsNullOrEmpty(endPoint) && Uri.TryCreate(endPoint, UriKind.Absolute, out endpointUri))
      {
        var secretClient = new SecretClient(endpointUri, credential);
        config.AddAzureKeyVault(secretClient, new KeyVaultSecretManager());
      }
    }
  });

Environment

Azure App Service Linux
.NET 6.0
System Assigned Managed Identity

For details see Support Case<PHONE_NUMBER>001183

Thank you for your feedback.  Tagging and routing to the team member best able to assist.

Could you share the exception message including the stack trace? What version of Azure.Security.KeyVault.Secrets was imported? Presumably 4.0.2 if you didn't import it explicitly, but we need to know for sure. What version of Azure.Identity did you import?
/cc @pakrym @schaabs as I'll be out on holiday soon and this also involves configuration extensions and identity.

Thanks for looking into this!
Please find the stack trace for the app service logstream attached:
log(1).txt
For Azure.Security.KeyVault.Secrets 4.1.0 is imported.
Maybe it helps:

It actually works locally. With both providers running.
When using not a shared TokenCredential (DefaultAzureCredential without configuration) it worked one time with both providers annd stopped working after first restart.
Current workaround is to have the one secret I've got in the Key Vault as Coniguration variable in the App Service and run without Key Vault.

What version of Azure.Identity are you importing to use DefaultAzureCredential? And what options are you passing it?
I do see in the stack that MSI is failing (which explains why it works locally - can't use MSI - but not remotely - which can use MSI), but where did you see the wrong scope is used? We get the scope from the 401 challenge response, so if you configured the DefaultAzureCredential with a different scope (perhaps for another service?) and used that, it would break the auth flow. Perhaps using separate DefaultAzureCredential instances for App Configuration and Key Vault would help.
2021-11-30T09:13:42.643557902Z Azure.Identity.AuthenticationFailedException: ManagedIdentityCredential authentication failed: Service request failed.
2021-11-30T09:13:42.643589603Z Status: 400 (Bad Request)
2021-11-30T09:13:42.643610903Z
2021-11-30T09:13:42.643615003Z Content:
2021-11-30T09:13:42.643618803Z
2021-11-30T09:13:42.643622403Z
2021-11-30T09:13:42.643626203Z Headers:
2021-11-30T09:13:42.643630203Z Date: Tue, 30 Nov 2021 09:13:39 GMT
2021-11-30T09:13:42.643651703Z Server: Kestrel
2021-11-30T09:13:42.643655603Z Transfer-Encoding: chunked
2021-11-30T09:13:42.643659503Z Content-Type: application/json; charset=utf-8
2021-11-30T09:13:42.643663404Z
2021-11-30T09:13:42.643681904Z See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/managedidentitycredential/troubleshoot
2021-11-30T09:13:42.643686804Z  ---> Azure.RequestFailedException: Service request failed.

Could you also log content? See https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md#enabling-content-logging. Feel free to just provide the content scrubbed of any PII like service principals, etc.

If you're using the latest Azure.Identity, we did recently add multi-tenant support which is also supported in the most recent Secrets 4.3.0-beta.2. While I don't suspect it should've regressed anything, you might try upgrading to that and let us know if only that solves the problem.

Please forgive me, I think I mixed up two problems. The wrong scope may be a different one I've seen in the same combination but with older versions of the libraries.
I would like to remove that from the GitHub issue and come back to that if I experience it again (especially as I do no longer have the logs :)).
I already tried different instances of DefaultAzureCredential with no other result than the BadRequest.
In general I do not pass any parameter to the DefaultAzureCredential ctor, nor have I set the AZURE_CLIENT_ID env var. Nevertheless I've tested both in both combinations (single instance of TokenCredential and seperate instance) with and without AZURE_CLIENT_ID env var. I was curious, because it worked one time (exactly on app startup) with both configuration providers, the next startup it failed again with the BadRequest error.
Do you think the new Secrest version will help? Following the StackTrace, it is failing at the App Configration, which is imported before the Key Vault?
I'll try to do the tests mentioned by you today and come back to this issue.

Please find the log below.
--> There it is again, the wrong scope (is https://vaulname.vault.azure.net, should be in my opinion https://vault.azure.net) - am I wrong with that? In the past there was the error, that the resource is not found in the tenant, while the Vault is definetely there.

Logs, Seperate `DefaultAzureCredential` instances, Key Vault included, Azure.Identity 1.5.0, Azure.Security.KeyVault.Secrets 4.3.0-beta.2
2021-12-06T08:23:16.283247009Z   _____
2021-12-06T08:23:16.283286510Z   /  _  \ __________ _________   ____
2021-12-06T08:23:16.283291710Z  /  /_\  \___   /  |  \_  __ \_/ __ \
2021-12-06T08:23:16.283295810Z /    |    \/    /|  |  /|  | \/\  ___/
2021-12-06T08:23:16.283299710Z \____|__  /_____ \____/ |__|    \___  >
2021-12-06T08:23:16.283303710Z         \/      \/                  \/
2021-12-06T08:23:16.283307410Z A P P   S E R V I C E   O N   L I N U X
2021-12-06T08:23:16.283310910Z
2021-12-06T08:23:16.283314210Z Documentation: http://aka.ms/webapp-linux
2021-12-06T08:23:16.283317810Z Dotnet quickstart: https://aka.ms/dotnet-qs
2021-12-06T08:23:16.283321310Z ASP .NETCore Version: 6.0.0
2021-12-06T08:23:16.283324710Z Note: Any data outside '/home' is not persisted
2021-12-06T08:23:16.971166394Z Running oryx create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -defaultAppFilePath /defaulthome/hostingstart/hostingstart.dll     -bindPort 8080 -userStartupCommand 'dotnet SMA.HyMon.API.Config.dll'
2021-12-06T08:23:17.422963332Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2021-12-06T08:23:17.423796043Z Could not find operation ID in manifest. Generating an operation id...
2021-12-06T08:23:17.424905056Z Build Operation ID: a2f642e5-329d-4f41-8760-b777c3fbe56b
2021-12-06T08:23:19.522936449Z
2021-12-06T08:23:19.523708558Z Agent extension
2021-12-06T08:23:19.524377367Z Before if loop >> DotNet Runtime
2021-12-06T08:23:20.219844395Z DotNet Runtime 6.0Writing output script to '/opt/startup/startup.sh'
2021-12-06T08:23:21.214001971Z Running user provided startup command...
2021-12-06T08:23:24.341478619Z [08:23:24 INF] Starting web host for App SMA.HyMon.API.Config
2021-12-06T08:23:24.550126238Z [08:23:24 INF] Application Info: 2.0.31+7ec16f0e6d, Git: 7ec16f0e6df123152d36ce88234648d3bf81798f, Build: 12/02/2021 11:49:06
2021-12-06T08:23:31.538871316Z [Informational] Azure-Identity: DefaultAzureCredential.GetToken invoked. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: c2f3ed80-f66a-4d37-8705-f6efe780dc14
2021-12-06T08:23:31.627432642Z [Informational] Azure-Identity: EnvironmentCredential.GetToken invoked. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: c2f3ed80-f66a-4d37-8705-f6efe780dc14
2021-12-06T08:23:31.654511656Z [Informational] Azure-Identity: EnvironmentCredential.GetToken was unable to retrieve an access token. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: c2f3ed80-f66a-4d37-8705-f6efe780dc14 Exception: Azure.Identity.CredentialUnavailableException (0x80131500): EnvironmentCredential authentication unavailable. Environment variables are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/environmentcredential/troubleshoot
2021-12-06T08:23:31.685664517Z [Informational] Azure-Identity: ManagedIdentityCredential.GetToken invoked. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: c2f3ed80-f66a-4d37-8705-f6efe780dc14
2021-12-06T08:23:31.870203655Z [Informational] Azure-Core: Request [23c437ca-8289-4973-bed0-d4ec7930c03a] GET http://<IP_ADDRESS>:8081/msi/token?api-version=REDACTED&resource=REDACTED
2021-12-06T08:23:31.870237055Z secret:REDACTED
2021-12-06T08:23:31.876674629Z x-ms-client-request-id:REDACTED
2021-12-06T08:23:31.876718630Z x-ms-return-client-request-id:REDACTED
2021-12-06T08:23:31.876725230Z User-Agent:REDACTED
2021-12-06T08:23:31.876729830Z client assembly: Azure.Identity
2021-12-06T08:23:45.948904239Z [Warning] Azure-Core: Error response [23c437ca-8289-4973-bed0-d4ec7930c03a] 400 Bad Request (14.0s)
2021-12-06T08:23:45.948991840Z Date:REDACTED
2021-12-06T08:23:45.949002640Z Server:REDACTED
2021-12-06T08:23:45.949008840Z Transfer-Encoding:REDACTED
2021-12-06T08:23:45.949014441Z Content-Type:REDACTED
2021-12-06T08:23:45.949019641Z
2021-12-06T08:23:45.958659962Z [Warning] Azure-Core: Response [23c437ca-8289-4973-bed0-d4ec7930c03a] took 14.0s
2021-12-06T08:23:46.060367737Z [Informational] Azure-Identity: ManagedIdentityCredential.GetToken was unable to retrieve an access token. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: c2f3ed80-f66a-4d37-8705-f6efe780dc14 Exception: Azure.Identity.AuthenticationFailedException (0x80131500): ManagedIdentityCredential authentication failed: Service request failed.
2021-12-06T08:23:46.060401138Z Status: 400 (Bad Request)
2021-12-06T08:23:46.060407738Z
2021-12-06T08:23:46.060412938Z Content:
2021-12-06T08:23:46.060417738Z
2021-12-06T08:23:46.060422338Z
2021-12-06T08:23:46.060426838Z Headers:
2021-12-06T08:23:46.068252636Z Date: Mon, 06 Dec 2021 08:23:45 GMT
2021-12-06T08:23:46.068280236Z Server: Kestrel
2021-12-06T08:23:46.068287736Z Transfer-Encoding: chunked
2021-12-06T08:23:46.068293537Z Content-Type: application/json; charset=utf-8
2021-12-06T08:23:46.068299237Z
2021-12-06T08:23:46.068304837Z See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/managedidentitycredential/troubleshoot
2021-12-06T08:23:46.068401138Z  ---> Azure.RequestFailedException (0x80131500): Service request failed.
2021-12-06T08:23:46.068407438Z Status: 400 (Bad Request)
2021-12-06T08:23:46.068413338Z
2021-12-06T08:23:46.068418938Z Content:
2021-12-06T08:23:46.068424438Z
2021-12-06T08:23:46.068429938Z
2021-12-06T08:23:46.068435438Z Headers:
2021-12-06T08:23:46.068441038Z Date: Mon, 06 Dec 2021 08:23:45 GMT
2021-12-06T08:23:46.068530139Z Server: Kestrel
2021-12-06T08:23:46.068535140Z Transfer-Encoding: chunked
2021-12-06T08:23:46.068540440Z Content-Type: application/json; charset=utf-8
2021-12-06T08:23:46.068555240Z
2021-12-06T08:23:46.095156873Z [Informational] Azure-Identity: DefaultAzureCredential.GetToken was unable to retrieve an access token. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: c2f3ed80-f66a-4d37-8705-f6efe780dc14 Exception: Azure.Identity.AuthenticationFailedException (0x80131500): ManagedIdentityCredential authentication failed: Service request failed.
2021-12-06T08:23:46.095215274Z Status: 400 (Bad Request)
2021-12-06T08:23:46.095225274Z
2021-12-06T08:23:46.095231774Z Content:
2021-12-06T08:23:46.095237674Z
2021-12-06T08:23:46.095243574Z
2021-12-06T08:23:46.095248975Z Headers:
2021-12-06T08:23:46.095254775Z Date: Mon, 06 Dec 2021 08:23:45 GMT
2021-12-06T08:23:46.095260675Z Server: Kestrel
2021-12-06T08:23:46.095266375Z Transfer-Encoding: chunked
2021-12-06T08:23:46.095352176Z Content-Type: application/json; charset=utf-8
2021-12-06T08:23:46.095358576Z
2021-12-06T08:23:46.104523291Z See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/managedidentitycredential/troubleshoot
2021-12-06T08:23:46.104546891Z  ---> Azure.RequestFailedException (0x80131500): Service request failed.
2021-12-06T08:23:46.104553291Z Status: 400 (Bad Request)
2021-12-06T08:23:46.104557991Z
2021-12-06T08:23:46.104562191Z Content:
2021-12-06T08:23:46.104566391Z
2021-12-06T08:23:46.104570491Z
2021-12-06T08:23:46.104575692Z Headers:
2021-12-06T08:23:46.104585792Z Date: Mon, 06 Dec 2021 08:23:45 GMT
2021-12-06T08:23:46.104590492Z Server: Kestrel
2021-12-06T08:23:46.104594592Z Transfer-Encoding: chunked
2021-12-06T08:23:46.104598592Z Content-Type: application/json; charset=utf-8
2021-12-06T08:23:46.104602892Z
2021-12-06T08:23:46.451972148Z [08:23:46 FTL] Host terminated unexpectedly
2021-12-06T08:23:46.452044349Z Azure.Identity.AuthenticationFailedException: ManagedIdentityCredential authentication failed: Service request failed.
2021-12-06T08:23:46.452051349Z Status: 400 (Bad Request)
2021-12-06T08:23:46.452056250Z
2021-12-06T08:23:46.452060750Z Content:
2021-12-06T08:23:46.452065150Z
2021-12-06T08:23:46.452069150Z
2021-12-06T08:23:46.452073250Z Headers:
2021-12-06T08:23:46.452077150Z Date: Mon, 06 Dec 2021 08:23:45 GMT
2021-12-06T08:23:46.460462255Z Server: Kestrel
2021-12-06T08:23:46.460485755Z Transfer-Encoding: chunked
2021-12-06T08:23:46.460498555Z Content-Type: application/json; charset=utf-8
2021-12-06T08:23:46.460503055Z
2021-12-06T08:23:46.460507156Z See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/managedidentitycredential/troubleshoot
2021-12-06T08:23:46.460523856Z  ---> Azure.RequestFailedException: Service request failed.
2021-12-06T08:23:46.460528756Z Status: 400 (Bad Request)
2021-12-06T08:23:46.460532656Z
2021-12-06T08:23:46.460536556Z Content:
2021-12-06T08:23:46.460540456Z
2021-12-06T08:23:46.460544256Z
2021-12-06T08:23:46.460548056Z Headers:
2021-12-06T08:23:46.460552056Z Date: Mon, 06 Dec 2021 08:23:45 GMT
2021-12-06T08:23:46.460555956Z Server: Kestrel
2021-12-06T08:23:46.460560356Z Transfer-Encoding: chunked
2021-12-06T08:23:46.460564256Z Content-Type: application/json; charset=utf-8
2021-12-06T08:23:46.460568256Z
2021-12-06T08:23:46.470599982Z    at Azure.Identity.ManagedIdentitySource.HandleResponseAsync(Boolean async, TokenRequestContext context, Response response, CancellationToken cancellationToken)
2021-12-06T08:23:46.470620382Z    at Azure.Identity.ManagedIdentitySource.AuthenticateAsync(Boolean async, TokenRequestContext context, CancellationToken cancellationToken)
2021-12-06T08:23:46.470892586Z    at Azure.Identity.ManagedIdentityClient.AuthenticateAsync(Boolean async, TokenRequestContext context, CancellationToken cancellationToken)
2021-12-06T08:23:46.470903186Z    at Azure.Identity.ManagedIdentityCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2021-12-06T08:23:46.470907886Z    --- End of inner exception stack trace ---
2021-12-06T08:23:46.470911786Z    at Azure.Identity.CredentialDiagnosticScope.FailWrapAndThrow(Exception ex, String additionalMessage)
2021-12-06T08:23:46.471931699Z    at Azure.Identity.ManagedIdentityCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2021-12-06T08:23:46.471948099Z    at Azure.Identity.ManagedIdentityCredential.GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
2021-12-06T08:23:46.471953299Z    at Azure.Identity.DefaultAzureCredential.GetTokenFromSourcesAsync(TokenCredential[] sources, TokenRequestContext requestContext, Boolean async, CancellationToken cancellationToken)
2021-12-06T08:23:46.472913411Z    at Azure.Identity.DefaultAzureCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2021-12-06T08:23:46.472929711Z    at Azure.Identity.CredentialDiagnosticScope.FailWrapAndThrow(Exception ex, String additionalMessage)
2021-12-06T08:23:46.472934711Z    at Azure.Identity.DefaultAzureCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2021-12-06T08:23:46.472947712Z    at Azure.Identity.DefaultAzureCredential.GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
2021-12-06T08:23:46.472952712Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueFromCredentialAsync(TokenRequestContext context, Boolean async, CancellationToken cancellationToken)
2021-12-06T08:23:46.472965912Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueAsync(HttpMessage message, TokenRequestContext context, Boolean async)
2021-12-06T08:23:46.478888386Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueAsync(HttpMessage message, TokenRequestContext context, Boolean async)
2021-12-06T08:23:46.478907486Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AuthenticateAndAuthorizeRequestAsync(HttpMessage message, TokenRequestContext context)
2021-12-06T08:23:46.478913986Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2021-12-06T08:23:46.478918886Z    at Azure.Core.Pipeline.RedirectPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2021-12-06T08:23:46.478923286Z    at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2021-12-06T08:23:46.478927887Z    at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2021-12-06T08:23:46.478932387Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.UserAgentHeaderPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2021-12-06T08:23:46.480821810Z    at Azure.Core.Pipeline.HttpPipeline.SendRequestAsync(Request request, CancellationToken cancellationToken)
2021-12-06T08:23:46.480849711Z    at Azure.Data.AppConfiguration.ConfigurationClient.GetConfigurationSettingsPageAsync(SettingSelector selector, String pageLink, CancellationToken cancellationToken)
2021-12-06T08:23:46.480856211Z    at Azure.Core.PageResponseEnumerator.FuncAsyncPageable`1.AsPages(String continuationToken, Nullable`1 pageSizeHint)+MoveNext()
2021-12-06T08:23:46.480860711Z    at Azure.Core.PageResponseEnumerator.FuncAsyncPageable`1.AsPages(String continuationToken, Nullable`1 pageSizeHint)+System.Threading.Tasks.Sources.IValueTaskSource.GetResult()
2021-12-06T08:23:46.480865811Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
2021-12-06T08:23:46.480869911Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
2021-12-06T08:23:46.480874211Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource.GetResult()
2021-12-06T08:23:46.480878611Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass20_3.<b__4>d.MoveNext()
2021-12-06T08:23:46.480883411Z --- End of stack trace from previous location ---
2021-12-06T08:23:46.480887411Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass20_3.<b__4>d.MoveNext()
2021-12-06T08:23:46.480891911Z --- End of stack trace from previous location ---
2021-12-06T08:23:46.480896011Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.TracingUtils.CallWithRequestTracing(Boolean tracingEnabled, RequestType requestType, RequestTracingOptions requestTracingOptions, Func`1 clientCall)
2021-12-06T08:23:46.480911611Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.CallWithRequestTracing(Func`1 clientCall)
2021-12-06T08:23:46.480916111Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.LoadAll(Boolean ignoreFailures)
2021-12-06T08:23:46.480920312Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.Load()
2021-12-06T08:23:46.480924312Z    at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
2021-12-06T08:23:46.480928312Z    at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
2021-12-06T08:23:46.480932412Z    at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
2021-12-06T08:23:46.480937112Z    at Microsoft.Extensions.Hosting.HostBuilder.Build()
2021-12-06T08:23:46.480941212Z    at SMA.HyMon.API.Config.Program.Main(String[] args) in C:\Users\papst\source\repos\HyMon\Hybrid Monitoring Cloud\src\SMA.HyMon.API.Config\Program.cs:line 44

This could be an issue with mixing the older Microsoft.Azure.AppConfiguration.AspNetCore with the newer Azure.Extensions.AspNetCore.Configuration.Secrets because, yes, the scope is wrong and should be merely https://vault.azure.net for the AzurePublic cloud. Instead, probably what you want to use is https://nuget.org/packages/Microsoft.Extensions.Configuration.AzureAppConfiguration. See this sample for a full walkthrough.

indeed, I was using the old package - but using this combination does not help either, I am ending with the same error:
        <PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.1" />
        <PackageReference Include="Microsoft.Extensions.Configuration.AzureAppConfiguration" Version="4.5.1" />

Just to be clear: I do not want to use Key Vault References in App Configuration, as the app configuration is a shared service, that is used by multiple applications. But each application can have its own key vault with the secrets that are only for that application necessary.

This seems similar to another issue that just came up recently. Since Azure.Extensions.AspNetCore.Configuration.Secrets depends on an old version of Azure.Security.KeyVault.Secrets, could you add an explicit reference to that for version 4.2.0 instead and see if the problem still repros?

Unfortunately that changed nothing.
Don't get fooled by the log entry "Build: 12/02/2021" as I did today.. its the last commit time :)

log
2022-01-06T07:10:45.146556947Z Agent extension
2022-01-06T07:10:45.146571847Z Before if loop >> DotNet Runtime
2022-01-06T07:10:45.661047873Z DotNet Runtime 6.0Writing output script to '/opt/startup/startup.sh'
2022-01-06T07:10:47.146253061Z Running user provided startup command...
2022-01-06T07:10:52.739582587Z [07:10:51 INF] Starting web host for App SMA.HyMon.API.Config
2022-01-06T07:10:53.024570603Z [07:10:52 INF] Application Info: 2.0.29+bcbd2525f7, Git: bcbd2525f7bb292a898f3efb29d68054a6c13525, Build: 12/02/2021 10:54:40
2022-01-06T07:11:15.236056998Z [07:11:13 FTL] Host terminated unexpectedly
2022-01-06T07:11:15.398301251Z Azure.Identity.AuthenticationFailedException: ManagedIdentityCredential authentication failed: Service request failed.
2022-01-06T07:11:15.398318551Z Status: 400 (Bad Request)
2022-01-06T07:11:15.398323351Z
2022-01-06T07:11:15.398327351Z Content:
2022-01-06T07:11:15.398342852Z
2022-01-06T07:11:15.398347952Z
2022-01-06T07:11:15.398351852Z Headers:
2022-01-06T07:11:15.398355752Z Date: Thu, 06 Jan 2022 07:11:11 GMT
2022-01-06T07:11:15.398359752Z Server: Kestrel
2022-01-06T07:11:15.398363652Z Transfer-Encoding: chunked
2022-01-06T07:11:15.398367652Z Content-Type: application/json; charset=utf-8
2022-01-06T07:11:15.453586970Z
2022-01-06T07:11:15.453615671Z See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/managedidentitycredential/troubleshoot
2022-01-06T07:11:15.453620871Z  ---> Azure.RequestFailedException: Service request failed.
2022-01-06T07:11:15.453625171Z Status: 400 (Bad Request)
2022-01-06T07:11:15.453628771Z
2022-01-06T07:11:15.453632171Z Content:
2022-01-06T07:11:15.453635571Z
2022-01-06T07:11:15.453638872Z
2022-01-06T07:11:15.453642172Z Headers:
2022-01-06T07:11:15.453645472Z Date: Thu, 06 Jan 2022 07:11:11 GMT
2022-01-06T07:11:15.453648972Z Server: Kestrel
2022-01-06T07:11:15.453652272Z Transfer-Encoding: chunked
2022-01-06T07:11:15.453655672Z Content-Type: application/json; charset=utf-8
2022-01-06T07:11:15.453659072Z
2022-01-06T07:11:15.453662572Z    at Azure.Identity.ManagedIdentitySource.HandleResponseAsync(Boolean async, TokenRequestContext context, Response response, CancellationToken cancellationToken)
2022-01-06T07:11:15.453666272Z    at Azure.Identity.ManagedIdentitySource.AuthenticateAsync(Boolean async, TokenRequestContext context, CancellationToken cancellationToken)
2022-01-06T07:11:15.453669972Z    at Azure.Identity.ManagedIdentityClient.AuthenticateAsync(Boolean async, TokenRequestContext context, CancellationToken cancellationToken)
2022-01-06T07:11:15.453673573Z    at Azure.Identity.ManagedIdentityCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-06T07:11:15.453677273Z    --- End of inner exception stack trace ---
2022-01-06T07:11:15.453680873Z    at Azure.Identity.CredentialDiagnosticScope.FailWrapAndThrow(Exception ex, String additionalMessage)
2022-01-06T07:11:15.453684373Z    at Azure.Identity.ManagedIdentityCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-06T07:11:15.453688073Z    at Azure.Identity.ManagedIdentityCredential.GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-06T07:11:15.453691673Z    at Azure.Identity.DefaultAzureCredential.GetTokenFromSourcesAsync(TokenCredential[] sources, TokenRequestContext requestContext, Boolean async, CancellationToken cancellationToken)
2022-01-06T07:11:15.453699973Z    at Azure.Identity.DefaultAzureCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-06T07:11:15.453703773Z    at Azure.Identity.CredentialDiagnosticScope.FailWrapAndThrow(Exception ex, String additionalMessage)
2022-01-06T07:11:15.453707274Z    at Azure.Identity.DefaultAzureCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-06T07:11:15.453710874Z    at Azure.Identity.DefaultAzureCredential.GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-06T07:11:15.453714474Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueFromCredentialAsync(TokenRequestContext context, Boolean async, CancellationToken cancellationToken)
2022-01-06T07:11:15.453722374Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueAsync(HttpMessage message, TokenRequestContext context, Boolean async)
2022-01-06T07:11:15.453738174Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueAsync(HttpMessage message, TokenRequestContext context, Boolean async)
2022-01-06T07:11:15.453742075Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AuthenticateAndAuthorizeRequestAsync(HttpMessage message, TokenRequestContext context)
2022-01-06T07:11:15.453745775Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-06T07:11:15.453749375Z    at Azure.Core.Pipeline.RedirectPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-06T07:11:15.453753175Z    at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-06T07:11:15.453756875Z    at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-06T07:11:15.453760575Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.UserAgentHeaderPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-06T07:11:15.453764375Z    at Azure.Core.Pipeline.HttpPipeline.SendRequestAsync(Request request, CancellationToken cancellationToken)
2022-01-06T07:11:15.453767975Z    at Azure.Data.AppConfiguration.ConfigurationClient.GetConfigurationSettingsPageAsync(SettingSelector selector, String pageLink, CancellationToken cancellationToken)
2022-01-06T07:11:15.453772775Z    at Azure.Core.PageResponseEnumerator.FuncAsyncPageable`1.AsPages(String continuationToken, Nullable`1 pageSizeHint)+MoveNext()
2022-01-06T07:11:15.453776576Z    at Azure.Core.PageResponseEnumerator.FuncAsyncPageable`1.AsPages(String continuationToken, Nullable`1 pageSizeHint)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
2022-01-06T07:11:15.453780776Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
2022-01-06T07:11:15.453784376Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
2022-01-06T07:11:15.453788176Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
2022-01-06T07:11:15.453792076Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass20_3.<<LoadAll>b__4>d.MoveNext()
2022-01-06T07:11:15.453796176Z --- End of stack trace from previous location ---
2022-01-06T07:11:15.453799776Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass20_3.<<LoadAll>b__4>d.MoveNext()
2022-01-06T07:11:15.453803976Z --- End of stack trace from previous location ---
2022-01-06T07:11:15.453807476Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.TracingUtils.CallWithRequestTracing(Boolean tracingEnabled, RequestType requestType, RequestTracingOptions requestTracingOptions, Func`1 clientCall)
2022-01-06T07:11:15.453814677Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.CallWithRequestTracing(Func`1 clientCall)
2022-01-06T07:11:15.453818477Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.LoadAll(Boolean ignoreFailures)
2022-01-06T07:11:15.453822277Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.Load()
2022-01-06T07:11:15.453825877Z    at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
2022-01-06T07:11:15.453829477Z    at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
2022-01-06T07:11:15.453833077Z    at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
2022-01-06T07:11:15.453836677Z    at Microsoft.Extensions.Hosting.HostBuilder.Build()
2022-01-06T07:11:15.453840277Z    at SMA.HyMon.API.Config.Program.Main(String[] args) in C:\Users\papst\source\repos\HyMon\Hybrid Monitoring Cloud\src\SMA.HyMon.API.Config\Program.cs:line 41
2022-01-06T07:11:15.456405253Z [07:11:15 INF] Application Info: 2.0.29+bcbd2525f7, Git: bcbd2525f7bb292a898f3efb29d68054a6c13525, Build: 12/02/2021 10:54:40

Thanks for the info, though unfortunate. I'm still trying to get a repro. It works when run locally against my user principal, and with a couple more changes to my deployment I'll test Managed Identity but it would help to understand your environment a bit better. So, I have some follow-up questions:

What exactly is using Managed Identity in this scenario? Is it just the web site (App Services)?
Which services are authorizing that Managed Identity? App Configuration, Key Vault, or both? (Assuming you're using RBAC for Key Vault.)
Do you still get the full Key Vault host in the scope e.g., https://myvault.vault.azure.net/.default, when using the newer assemblies, or did that resolve? I assume at this point you probably can't know (assuming your repro code above is the same or close to your production code) because the exception is thrown earlier, but is it possible to comment out the App Configuration code and test that Key Vault authentication is working now? In one other bug I'm investigating that has the same problem with the full host in the scope, it does seem to be a problem with mixing older and newer assemblies (we suspect), so hopefully with your package updates that no longer repros.

Will follow up with more informations and repro tomorrow.
So long:

The above is production code (except the method name and I inlined it from having it in a nuget before).
The KV is using RBAC
The Principal is used for: KV, AppConfig, CosmosDb (Preview)
I've seen that behavior only in app service right now.. can try with a container maybe next week.

Test 1:
KeyVault & AppConfig, with extended Logging
--> Creates the same Log Output as before

Test 1, Code
  public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
      //.ConfigureHyMonApplication(AppName, Credential)
      .ConfigureAppConfiguration((_, config) =>
      {
        config
          .AddEnvironmentVariables()
          .AddJsonFile("appsettings.json", optional: true)
          .AddInMemoryCollection(new Dictionary<string, string>()
          {
            ["AppName"] = AppName
          });

        var built = config.Build();
        var endPoint = built["AzureAppConfigurationEndpoint"];
        if (!string.IsNullOrEmpty(endPoint) && Uri.TryCreate(endPoint, UriKind.Absolute, out Uri? endpointUri))
        {
          DefaultAzureCredential credential = new(new DefaultAzureCredentialOptions()
          {
            Diagnostics =
            {
                LoggedQueryParameters = { "resource" },
            },
          });
          config.AddAzureAppConfiguration(appCfg =>
            appCfg
              .ConfigureClientOptions(configure =>
              {
                configure.Diagnostics.LoggedHeaderNames.Add("WWW-Authenticate");
              })
              .Connect(endpointUri, credential)
              .Select(Microsoft.Extensions.Configuration.AzureAppConfiguration.KeyFilter.Any)
          );
        }

        endPoint = built["AzureKeyVaultEndpoint"];
        if (!string.IsNullOrEmpty(endPoint) && Uri.TryCreate(endPoint, UriKind.Absolute, out endpointUri))
        {
          DefaultAzureCredential credential = new(new DefaultAzureCredentialOptions()
          {
            Diagnostics =
            {
                LoggedQueryParameters = { "resource" },
            },
          });
          var secretClient = new SecretClient(endpointUri, credential, new SecretClientOptions()
          {
            Diagnostics =
            {
                LoggedHeaderNames = {"WWW-Authenticate" },
            }
          });
          config.AddAzureKeyVault(secretClient, new KeyVaultSecretManager());
        }
      })
      .ConfigureWebHostDefaults(webBuilder =>
      {
        webBuilder.UseStartup<Startup>()
          .UseSerilog(logger: Log.Logger);
      });

Test 1, Log
2022-01-07T11:12:34.741894776Z [11:12:33 INF] Starting web host for App SMA.HyMon.API.Config
2022-01-07T11:12:35.518671963Z [11:12:35 INF] Application Info: 2.0.56+cbe9899f57, Git: cbe9899f5719b7f0d5915d77275dd19d98804c11, Build: 01/07/2022 11:08:23
2022-01-07T11:13:15.874027839Z [11:13:15 FTL] Host terminated unexpectedly
2022-01-07T11:13:15.882465594Z Azure.Identity.AuthenticationFailedException: ManagedIdentityCredential authentication failed: Service request failed.
2022-01-07T11:13:15.882484094Z Status: 400 (Bad Request)
2022-01-07T11:13:15.882488494Z
2022-01-07T11:13:15.882492494Z Content:
2022-01-07T11:13:15.882496994Z
2022-01-07T11:13:15.882500894Z
2022-01-07T11:13:15.882504794Z Headers:
2022-01-07T11:13:15.882509494Z Date: Fri, 07 Jan 2022 11:13:15 GMT
2022-01-07T11:13:15.882518594Z Server: Kestrel
2022-01-07T11:13:15.882522694Z Transfer-Encoding: chunked
2022-01-07T11:13:15.882526693Z Content-Type: application/json; charset=utf-8
2022-01-07T11:13:15.882530693Z
2022-01-07T11:13:15.882534693Z See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/managedidentitycredential/troubleshoot
2022-01-07T11:13:15.882549593Z  ---> Azure.RequestFailedException: Service request failed.
2022-01-07T11:13:15.882553993Z Status: 400 (Bad Request)
2022-01-07T11:13:15.882557693Z
2022-01-07T11:13:15.882561093Z Content:
2022-01-07T11:13:15.882564493Z
2022-01-07T11:13:15.882568293Z
2022-01-07T11:13:15.882571593Z Headers:
2022-01-07T11:13:15.882575093Z Date: Fri, 07 Jan 2022 11:13:15 GMT
2022-01-07T11:13:15.882578693Z Server: Kestrel
2022-01-07T11:13:15.882582293Z Transfer-Encoding: chunked
2022-01-07T11:13:15.882585993Z Content-Type: application/json; charset=utf-8
2022-01-07T11:13:15.882589593Z
2022-01-07T11:13:15.882593293Z    at Azure.Identity.ManagedIdentitySource.HandleResponseAsync(Boolean async, TokenRequestContext context, Response response, CancellationToken cancellationToken)
2022-01-07T11:13:15.882597293Z    at Azure.Identity.ManagedIdentitySource.AuthenticateAsync(Boolean async, TokenRequestContext context, CancellationToken cancellationToken)
2022-01-07T11:13:15.882601193Z    at Azure.Identity.ManagedIdentityClient.AuthenticateAsync(Boolean async, TokenRequestContext context, CancellationToken cancellationToken)
2022-01-07T11:13:15.882604993Z    at Azure.Identity.ManagedIdentityCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-07T11:13:15.882608793Z    --- End of inner exception stack trace ---
2022-01-07T11:13:15.882612293Z    at Azure.Identity.CredentialDiagnosticScope.FailWrapAndThrow(Exception ex, String additionalMessage)
2022-01-07T11:13:15.882615893Z    at Azure.Identity.ManagedIdentityCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-07T11:13:15.882619693Z    at Azure.Identity.ManagedIdentityCredential.GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-07T11:13:15.882623393Z    at Azure.Identity.DefaultAzureCredential.GetTokenFromSourcesAsync(TokenCredential[] sources, TokenRequestContext requestContext, Boolean async, CancellationToken cancellationToken)
2022-01-07T11:13:15.882627093Z    at Azure.Identity.DefaultAzureCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-07T11:13:15.882630793Z    at Azure.Identity.CredentialDiagnosticScope.FailWrapAndThrow(Exception ex, String additionalMessage)
2022-01-07T11:13:15.882635093Z    at Azure.Identity.DefaultAzureCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-07T11:13:15.882638793Z    at Azure.Identity.DefaultAzureCredential.GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-07T11:13:15.882642493Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueFromCredentialAsync(TokenRequestContext context, Boolean async, CancellationToken cancellationToken)
2022-01-07T11:13:15.882649093Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueAsync(HttpMessage message, TokenRequestContext context, Boolean async)
2022-01-07T11:13:15.882653093Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueAsync(HttpMessage message, TokenRequestContext context, Boolean async)
2022-01-07T11:13:15.882656793Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AuthenticateAndAuthorizeRequestAsync(HttpMessage message, TokenRequestContext context)
2022-01-07T11:13:15.882660493Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T11:13:15.882664293Z    at Azure.Core.Pipeline.RedirectPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T11:13:15.882668093Z    at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T11:13:15.882671693Z    at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T11:13:15.882675293Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.UserAgentHeaderPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T11:13:15.882679093Z    at Azure.Core.Pipeline.HttpPipeline.SendRequestAsync(Request request, CancellationToken cancellationToken)
2022-01-07T11:13:15.882682693Z    at Azure.Data.AppConfiguration.ConfigurationClient.GetConfigurationSettingsPageAsync(SettingSelector selector, String pageLink, CancellationToken cancellationToken)
2022-01-07T11:13:15.882686393Z    at Azure.Core.PageResponseEnumerator.FuncAsyncPageable`1.AsPages(String continuationToken, Nullable`1 pageSizeHint)+MoveNext()
2022-01-07T11:13:15.882690293Z    at Azure.Core.PageResponseEnumerator.FuncAsyncPageable`1.AsPages(String continuationToken, Nullable`1 pageSizeHint)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
2022-01-07T11:13:15.882695093Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
2022-01-07T11:13:15.882698793Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
2022-01-07T11:13:15.882702393Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
2022-01-07T11:13:15.882706293Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass20_3.<<LoadAll>b__4>d.MoveNext()
2022-01-07T11:13:15.882710293Z --- End of stack trace from previous location ---
2022-01-07T11:13:15.882713792Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass20_3.<<LoadAll>b__4>d.MoveNext()
2022-01-07T11:13:15.882717692Z --- End of stack trace from previous location ---
2022-01-07T11:13:15.882721392Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.TracingUtils.CallWithRequestTracing(Boolean tracingEnabled, RequestType requestType, RequestTracingOptions requestTracingOptions, Func`1 clientCall)
2022-01-07T11:13:15.882728392Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.CallWithRequestTracing(Func`1 clientCall)
2022-01-07T11:13:15.882732592Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.LoadAll(Boolean ignoreFailures)
2022-01-07T11:13:15.882736292Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.Load()
2022-01-07T11:13:15.882739992Z    at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
2022-01-07T11:13:15.882743692Z    at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
2022-01-07T11:13:15.882747392Z    at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
2022-01-07T11:13:15.882751092Z    at Microsoft.Extensions.Hosting.HostBuilder.Build()
2022-01-07T11:13:15.882754592Z    at SMA.HyMon.API.Config.Program.Main(String[] args) in C:\Users\papst\source\repos\HyMon\Hybrid Monitoring Cloud\src\SMA.HyMon.API.Config\Program.cs:line 41
2022-01-07T11:13:16.004841040Z [11:13:16 INF] Application Info: 2.0.56+cbe9899f57, Git: cbe9899f5719b7f0d5915d77275dd19d98804c11, Build: 01/07/2022 11:08:23

Test 2:
Same Code, no App Config only Key Vault
--> works, except that all configuration values are missing. But I do not see any additional log information
I double checked that the code is the correct one, but the Git commit hash in the log matches the one Git shows

Test 2, Logs
2022-01-07T11:20:54.730111031Z [11:20:54 INF] Starting web host for App SMA.HyMon.API.Config
2022-01-07T11:20:55.768261077Z [11:20:55 INF] Application Info: 2.0.56+cbe9899f57, Git: cbe9899f5719b7f0d5915d77275dd19d98804c11, Build: 01/07/2022 11:08:23
2022-01-07T11:21:22.895334243Z [11:21:22 INF] Azure Web Sites environment detected. Using '/home/ASP.NET/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
2022-01-07T11:21:24.273837897Z [11:21:24 INF] Now listening on: http://[::]:8080
2022-01-07T11:21:24.303906937Z [11:21:24 INF] Application started. Press Ctrl+C to shut down.
2022-01-07T11:21:24.304505633Z [11:21:24 INF] Hosting environment: Production
2022-01-07T11:21:24.311662995Z [11:21:24 INF] Content root path: /home/site/wwwroot
2022-01-07T11:21:24.888928422Z [11:21:24 INF] Request starting HTTP/1.1 GET http://<IP_ADDRESS>:8080/robots933456.txt - -
2022-01-07T11:21:24.927549017Z [11:21:24 WRN] Failed to determine the https port for redirect.
2022-01-07T11:21:25.494584298Z [11:21:25 ERR] Connection id "0HMEHPVBI6SU1", Request id "0HMEHPVBI6SU1:00000002": An unhandled exception was thrown by the application.
2022-01-07T11:21:25.494619998Z System.ArgumentNullException: IDW10106: The 'ClientId' option must be provided.
2022-01-07T11:21:25.495833992Z    at Microsoft.Identity.Web.MergedOptionsValidation.Validate(MergedOptions options)
2022-01-07T11:21:25.495846592Z    at Microsoft.Identity.Web.MicrosoftIdentityWebApiAuthenticationBuilderExtensions.<>c__DisplayClass3_0.<AddMicrosoftIdentityWebApiImplementation>b__0(JwtBearerOptions options, IServiceProvider serviceProvider, IOptionsMonitor`1 mergedOptionsMonitor, IOptionsMonitor`1 msIdOptionsMonitor, IOptions`1 msIdOptions)
2022-01-07T11:21:25.495850892Z    at Microsoft.Extensions.Options.ConfigureNamedOptions`5.Configure(String name, TOptions options)
2022-01-07T11:21:25.495853992Z    at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
2022-01-07T11:21:25.495857092Z    at Microsoft.Extensions.Options.OptionsMonitor`1.<>c__DisplayClass10_0.<Get>b__0()
2022-01-07T11:21:25.495860392Z    at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
2022-01-07T11:21:25.495868092Z    at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
2022-01-07T11:21:25.495871092Z    at System.Lazy`1.CreateValue()
2022-01-07T11:21:25.495873892Z    at System.Lazy`1.get_Value()
2022-01-07T11:21:25.495876792Z    at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd(String name, Func`1 createOptions)
2022-01-07T11:21:25.495879692Z    at Microsoft.Extensions.Options.OptionsMonitor`1.Get(String name)
2022-01-07T11:21:25.495882592Z    at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.InitializeAsync(AuthenticationScheme scheme, HttpContext context)
2022-01-07T11:21:25.503983648Z    at Microsoft.AspNetCore.Authentication.AuthenticationHandlerProvider.GetHandlerAsync(HttpContext context, String authenticationScheme)
2022-01-07T11:21:25.504005748Z    at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
2022-01-07T11:21:25.504010148Z    at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
2022-01-07T11:21:25.504269247Z    at SMA.HyMon.Runtime.AspNetCore.SecurityExtensions.<>c.<<UseSecurityPolicies>b__0_5>d.MoveNext()
2022-01-07T11:21:25.504276947Z --- End of stack trace from previous location ---
2022-01-07T11:21:25.504280847Z    at NWebsec.AspNetCore.Middleware.Middleware.CspMiddleware.Invoke(HttpContext context)
2022-01-07T11:21:25.504289947Z    at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
2022-01-07T11:21:25.504293647Z    at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
2022-01-07T11:21:25.504297147Z    at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
2022-01-07T11:21:25.504300747Z    at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
2022-01-07T11:21:25.504304247Z    at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
2022-01-07T11:21:25.504307847Z    at NSwag.AspNetCore.Middlewares.SwaggerUiIndexMiddleware.Invoke(HttpContext context)
2022-01-07T11:21:25.504319147Z    at NSwag.AspNetCore.Middlewares.RedirectToIndexMiddleware.Invoke(HttpContext context)
2022-01-07T11:21:25.504322947Z    at NSwag.AspNetCore.Middlewares.OpenApiDocumentMiddleware.Invoke(HttpContext context)
2022-01-07T11:21:25.504326547Z    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
2022-01-07T11:21:25.583434125Z [11:21:25 INF] Request finished HTTP/1.1 GET http://<IP_ADDRESS>:8080/robots933456.txt - - - 500 0 - 705.5956ms

I'm so sorry, but I forgot to copy a crucial line from my repro. If you have AppInsights enabled, the logs will already be there, but if not, you need to hook up a logger as well. A console logger will work, which you can do if you add this near the top of your method in the sample code:
using var listener = AzureEventSourceListener.CreateConsoleLogger(EventLevel.Verbose);

See here for an example. It will automatically log crucial information to the console from our event sources.
/cc @annelo-msft @schaabs
Given this is only happening with the App Configuration client, have you double checked to make sure the Managed Identity has the App Configuration Data Reader role assigned as shown here in my sample? I'd expect a 403 in that case instead of a 400, though.

The roles of the Identity are correct:

Try 1: With Event Source Listener, only App Config
2022-01-07T18:35:46.022469055Z [18:35:45 INF] Starting web host for App SMA.HyMon.API.Config
2022-01-07T18:35:46.280164827Z [18:35:46 INF] Application Info: 2.0.56+cbe9899f57, Git: cbe9899f5719b7f0d5915d77275dd19d98804c11, Build: 01/07/2022 11:08:23
2022-01-07T18:35:51.572692400Z [Informational] Azure-Identity: DefaultAzureCredential.GetToken invoked. Scopes: [ https://hymon-dev.azconfig.io/.default ] ParentRequestId: 4509b95f-9900-4d4b-a64e-f5f0420afa85
2022-01-07T18:35:51.594208180Z [Informational] Azure-Identity: EnvironmentCredential.GetToken invoked. Scopes: [ https://hymon-dev.azconfig.io/.default ] ParentRequestId: 4509b95f-9900-4d4b-a64e-f5f0420afa85
2022-01-07T18:35:51.612233881Z [Informational] Azure-Identity: EnvironmentCredential.GetToken was unable to retrieve an access token. Scopes: [ https://hymon-dev.azconfig.io/.default ] ParentRequestId: 4509b95f-9900-4d4b-a64e-f5f0420afa85 Exception: Azure.Identity.CredentialUnavailableException (0x80131500): EnvironmentCredential authentication unavailable. Environment variables are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/environmentcredential/troubleshoot
2022-01-07T18:35:51.827084490Z [Informational] Azure-Identity: ManagedIdentityCredential.GetToken invoked. Scopes: [ https://hymon-dev.azconfig.io/.default ] ParentRequestId: 4509b95f-9900-4d4b-a64e-f5f0420afa85
2022-01-07T18:35:51.898078497Z [Informational] Azure-Core: Request [c1123a8e-4312-4d6b-b0f6-cd6bae684043] GET http://<IP_ADDRESS>:8081/msi/token?api-version=REDACTED&resource=REDACTED
2022-01-07T18:35:51.898119596Z secret:REDACTED
2022-01-07T18:35:51.995785855Z x-ms-client-request-id:REDACTED
2022-01-07T18:35:51.995800555Z x-ms-return-client-request-id:REDACTED
2022-01-07T18:35:51.995804655Z User-Agent:REDACTED
2022-01-07T18:35:51.995808355Z client assembly: Azure.Identity
2022-01-07T18:36:09.166519233Z [Informational] Azure-Core: Response [c1123a8e-4312-4d6b-b0f6-cd6bae684043] 200 OK (17.2s)
2022-01-07T18:36:09.166543133Z Date:REDACTED
2022-01-07T18:36:09.166548233Z Server:REDACTED
2022-01-07T18:36:09.166552333Z Transfer-Encoding:REDACTED
2022-01-07T18:36:09.166556633Z Content-Type:REDACTED
2022-01-07T18:36:09.166560733Z
2022-01-07T18:36:09.175492783Z [Warning] Azure-Core: Response [c1123a8e-4312-4d6b-b0f6-cd6bae684043] took 17.2s
2022-01-07T18:36:09.296841609Z [Informational] Azure-Identity: ManagedIdentityCredential.GetToken succeeded. Scopes: [ https://hymon-dev.azconfig.io/.default ] ParentRequestId: 4509b95f-9900-4d4b-a64e-f5f0420afa85 ExpiresOn: 2022-01-08T18:36:06.0000000+00:00
2022-01-07T18:36:09.347156629Z [Informational] Azure-Identity: DefaultAzureCredential credential selected: Azure.Identity.ManagedIdentityCredential
2022-01-07T18:36:09.347505627Z [Informational] Azure-Identity: DefaultAzureCredential.GetToken succeeded. Scopes: [ https://hymon-dev.azconfig.io/.default ] ParentRequestId: 4509b95f-9900-4d4b-a64e-f5f0420afa85 ExpiresOn: 2022-01-08T18:36:06.0000000+00:00
2022-01-07T18:36:09.477095107Z [Informational] Azure-Core: Request [4509b95f-9900-4d4b-a64e-f5f0420afa85] GET https://hymon-dev.azconfig.io/kv/?key=REDACTED&label=REDACTED&api-version=REDACTED
2022-01-07T18:36:09.477141907Z Accept:REDACTED
2022-01-07T18:36:09.477147607Z Correlation-Context:REDACTED
2022-01-07T18:36:09.477151707Z User-Agent:REDACTED
2022-01-07T18:36:09.477542005Z x-ms-client-request-id:REDACTED
2022-01-07T18:36:09.478161201Z x-ms-return-client-request-id:REDACTED
2022-01-07T18:36:09.478174301Z Authorization:REDACTED
2022-01-07T18:36:09.478178101Z client assembly: Azure.Data.AppConfiguration
2022-01-07T18:36:10.607788530Z [Informational] Azure-Core: Response [4509b95f-9900-4d4b-a64e-f5f0420afa85] 200 OK (01.1s)
2022-01-07T18:36:10.607818530Z Server:REDACTED
2022-01-07T18:36:10.607824330Z Date:REDACTED
2022-01-07T18:36:10.607828830Z Transfer-Encoding:REDACTED
2022-01-07T18:36:10.607878529Z Connection:REDACTED
2022-01-07T18:36:10.607883529Z Sync-Token:REDACTED
2022-01-07T18:36:10.607887529Z x-ms-request-id:REDACTED
2022-01-07T18:36:10.607891729Z x-ms-client-request-id:REDACTED
2022-01-07T18:36:10.607895829Z x-ms-correlation-request-id:REDACTED
2022-01-07T18:36:10.608250627Z Access-Control-Allow-Origin:REDACTED
2022-01-07T18:36:10.608257927Z Access-Control-Allow-Credentials:REDACTED
2022-01-07T18:36:10.608261227Z Access-Control-Expose-Headers:REDACTED
2022-01-07T18:36:10.608264027Z Strict-Transport-Security:REDACTED
2022-01-07T18:36:10.608267027Z Content-Type:REDACTED
2022-01-07T18:36:10.608270027Z
2022-01-07T18:36:12.772803863Z [18:36:12 INF] Azure Web Sites environment detected. Using '/home/ASP.NET/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
2022-01-07T18:36:15.211522084Z [18:36:15 INF] Now listening on: http://[::]:8080
2022-01-07T18:36:15.221523229Z [18:36:15 INF] Application started. Press Ctrl+C to shut down.
2022-01-07T18:36:15.221540929Z [18:36:15 INF] Hosting environment: Production
2022-01-07T18:36:15.221545629Z [18:36:15 INF] Content root path: /home/site/wwwroot
2022-01-07T18:36:25.744449861Z [18:36:25 INF] Request starting HTTP/1.1 GET http://<IP_ADDRESS>:8080/robots933456.txt - -
2022-01-07T18:36:25.774529196Z [18:36:25 WRN] Failed to determine the https port for redirect.
2022-01-07T18:36:26.280135636Z [18:36:26 INF] Request finished HTTP/1.1 GET http://<IP_ADDRESS>:8080/robots933456.txt - - - 404 0 - 553.8899ms
2022-01-07T18:36:26.709173586Z [18:36:26 INF] Request starting HTTP/1.1 GET http://<IP_ADDRESS>:8081/robots933456.txt - 0
2022-01-07T18:36:26.720370924Z [18:36:26 INF] Request finished HTTP/1.1 GET http://<IP_ADDRESS>:8081/robots933456.txt - 0 - 404 0 - 11.2128ms

So far so good. I am not sure about all those robots.txt requests, but the seem to come from the Library?

Try 2: With Event Source Listener, App Config & Key Vault
2022-01-07T18:40:41.278576394Z [18:40:40 INF] Starting web host for App SMA.HyMon.API.Config
2022-01-07T18:40:43.563659119Z [18:40:43 INF] Application Info: 2.0.56+cbe9899f57, Git: cbe9899f5719b7f0d5915d77275dd19d98804c11, Build: 01/07/2022 11:08:23
2022-01-07T18:40:59.178919102Z [Informational] Azure-Identity: DefaultAzureCredential.GetToken invoked. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: 6a11017b-6c04-4734-94d5-e7dbff0ab419
2022-01-07T18:40:59.179353000Z [Informational] Azure-Identity: EnvironmentCredential.GetToken invoked. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: 6a11017b-6c04-4734-94d5-e7dbff0ab419
2022-01-07T18:40:59.219836083Z [Informational] Azure-Identity: EnvironmentCredential.GetToken was unable to retrieve an access token. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: 6a11017b-6c04-4734-94d5-e7dbff0ab419 Exception: Azure.Identity.CredentialUnavailableException (0x80131500): EnvironmentCredential authentication unavailable. Environment variables are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/environmentcredential/troubleshoot
2022-01-07T18:40:59.508454541Z [Informational] Azure-Identity: ManagedIdentityCredential.GetToken invoked. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: 6a11017b-6c04-4734-94d5-e7dbff0ab419
2022-01-07T18:41:00.129436023Z [Informational] Azure-Core: Request [88a39a25-e39b-4b2e-930f-7e30527d44e5] GET http://<IP_ADDRESS>:8081/msi/token?api-version=REDACTED&resource=REDACTED
2022-01-07T18:41:00.129459023Z secret:REDACTED
2022-01-07T18:41:00.379439087Z x-ms-client-request-id:REDACTED
2022-01-07T18:41:00.379455687Z x-ms-return-client-request-id:REDACTED
2022-01-07T18:41:00.379459987Z User-Agent:REDACTED
2022-01-07T18:41:00.379463587Z client assembly: Azure.Identity
2022-01-07T18:41:27.380147122Z [Warning] Azure-Core: Error response [88a39a25-e39b-4b2e-930f-7e30527d44e5] 400 Bad Request (27.0s)
2022-01-07T18:41:27.380470720Z Date:REDACTED
2022-01-07T18:41:27.380478520Z Server:REDACTED
2022-01-07T18:41:27.380481920Z Transfer-Encoding:REDACTED
2022-01-07T18:41:27.380485220Z Content-Type:REDACTED
2022-01-07T18:41:27.380488520Z
2022-01-07T18:41:27.389636270Z [Warning] Azure-Core: Response [88a39a25-e39b-4b2e-930f-7e30527d44e5] took 27.0s
2022-01-07T18:41:27.591579070Z [Informational] Azure-Identity: ManagedIdentityCredential.GetToken was unable to retrieve an access token. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: 6a11017b-6c04-4734-94d5-e7dbff0ab419 Exception: Azure.Identity.AuthenticationFailedException (0x80131500): ManagedIdentityCredential authentication failed: Service request failed.
2022-01-07T18:41:27.591604570Z Status: 400 (Bad Request)
2022-01-07T18:41:27.591608870Z
2022-01-07T18:41:27.591719069Z Content:
2022-01-07T18:41:27.591726169Z
2022-01-07T18:41:27.591729469Z
2022-01-07T18:41:27.591732669Z Headers:
2022-01-07T18:41:27.591735969Z Date: Fri, 07 Jan 2022 18:41:25 GMT
2022-01-07T18:41:27.591739369Z Server: Kestrel
2022-01-07T18:41:27.591742669Z Transfer-Encoding: chunked
2022-01-07T18:41:27.591745969Z Content-Type: application/json; charset=utf-8
2022-01-07T18:41:27.591749169Z
2022-01-07T18:41:27.591752569Z See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/managedidentitycredential/troubleshoot
2022-01-07T18:41:27.591755969Z  ---> Azure.RequestFailedException (0x80131500): Service request failed.
2022-01-07T18:41:27.591759569Z Status: 400 (Bad Request)
2022-01-07T18:41:27.591762869Z
2022-01-07T18:41:27.591766069Z Content:
2022-01-07T18:41:27.591769269Z
2022-01-07T18:41:27.591772469Z
2022-01-07T18:41:27.591898068Z Headers:
2022-01-07T18:41:27.591903568Z Date: Fri, 07 Jan 2022 18:41:25 GMT
2022-01-07T18:41:27.591950968Z Server: Kestrel
2022-01-07T18:41:27.591955768Z Transfer-Encoding: chunked
2022-01-07T18:41:27.591959168Z Content-Type: application/json; charset=utf-8
2022-01-07T18:41:27.591974068Z
2022-01-07T18:41:27.710831320Z [Informational] Azure-Identity: DefaultAzureCredential.GetToken was unable to retrieve an access token. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: 6a11017b-6c04-4734-94d5-e7dbff0ab419 Exception: Azure.Identity.AuthenticationFailedException (0x80131500): ManagedIdentityCredential authentication failed: Service request failed.
2022-01-07T18:41:27.710892420Z Status: 400 (Bad Request)
2022-01-07T18:41:27.710897620Z
2022-01-07T18:41:27.710900820Z Content:
2022-01-07T18:41:27.710903720Z
2022-01-07T18:41:27.710906420Z
2022-01-07T18:41:27.710909320Z Headers:
2022-01-07T18:41:27.710912020Z Date: Fri, 07 Jan 2022 18:41:25 GMT
2022-01-07T18:41:27.710914920Z Server: Kestrel
2022-01-07T18:41:27.710917820Z Transfer-Encoding: chunked
2022-01-07T18:41:27.710920620Z Content-Type: application/json; charset=utf-8
2022-01-07T18:41:27.710923520Z
2022-01-07T18:41:27.713130208Z See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/managedidentitycredential/troubleshoot
2022-01-07T18:41:27.713141307Z  ---> Azure.RequestFailedException (0x80131500): Service request failed.
2022-01-07T18:41:27.713144807Z Status: 400 (Bad Request)
2022-01-07T18:41:27.713147707Z
2022-01-07T18:41:27.713150507Z Content:
2022-01-07T18:41:27.713153507Z
2022-01-07T18:41:27.713156207Z
2022-01-07T18:41:27.713165007Z Headers:
2022-01-07T18:41:27.713167907Z Date: Fri, 07 Jan 2022 18:41:25 GMT
2022-01-07T18:41:27.713170807Z Server: Kestrel
2022-01-07T18:41:27.713173707Z Transfer-Encoding: chunked
2022-01-07T18:41:27.713176607Z Content-Type: application/json; charset=utf-8
2022-01-07T18:41:27.713179507Z
2022-01-07T18:41:28.405292836Z [18:41:27 FTL] Host terminated unexpectedly
2022-01-07T18:41:28.405314536Z Azure.Identity.AuthenticationFailedException: ManagedIdentityCredential authentication failed: Service request failed.
2022-01-07T18:41:28.405318836Z Status: 400 (Bad Request)
2022-01-07T18:41:28.405321836Z
2022-01-07T18:41:28.414473386Z Content:
2022-01-07T18:41:28.414491086Z
2022-01-07T18:41:28.414494786Z
2022-01-07T18:41:28.414497886Z Headers:
2022-01-07T18:41:28.414501186Z Date: Fri, 07 Jan 2022 18:41:25 GMT
2022-01-07T18:41:28.414506986Z Server: Kestrel
2022-01-07T18:41:28.414510186Z Transfer-Encoding: chunked
2022-01-07T18:41:28.414513586Z Content-Type: application/json; charset=utf-8
2022-01-07T18:41:28.414516986Z
2022-01-07T18:41:28.414520286Z See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/managedidentitycredential/troubleshoot
2022-01-07T18:41:28.414536186Z  ---> Azure.RequestFailedException: Service request failed.
2022-01-07T18:41:28.414539886Z Status: 400 (Bad Request)
2022-01-07T18:41:28.414543186Z
2022-01-07T18:41:28.414546186Z Content:
2022-01-07T18:41:28.414549386Z
2022-01-07T18:41:28.414552586Z
2022-01-07T18:41:28.414555786Z Headers:
2022-01-07T18:41:28.414558786Z Date: Fri, 07 Jan 2022 18:41:25 GMT
2022-01-07T18:41:28.414561986Z Server: Kestrel
2022-01-07T18:41:28.414565086Z Transfer-Encoding: chunked
2022-01-07T18:41:28.414568286Z Content-Type: application/json; charset=utf-8
2022-01-07T18:41:28.414571386Z
2022-01-07T18:41:28.414574586Z    at Azure.Identity.ManagedIdentitySource.HandleResponseAsync(Boolean async, TokenRequestContext context, Response response, CancellationToken cancellationToken)
2022-01-07T18:41:28.414578086Z    at Azure.Identity.ManagedIdentitySource.AuthenticateAsync(Boolean async, TokenRequestContext context, CancellationToken cancellationToken)
2022-01-07T18:41:28.414581586Z    at Azure.Identity.ManagedIdentityClient.AuthenticateAsync(Boolean async, TokenRequestContext context, CancellationToken cancellationToken)
2022-01-07T18:41:28.414584986Z    at Azure.Identity.ManagedIdentityCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-07T18:41:28.414588386Z    --- End of inner exception stack trace ---
2022-01-07T18:41:28.414591586Z    at Azure.Identity.CredentialDiagnosticScope.FailWrapAndThrow(Exception ex, String additionalMessage)
2022-01-07T18:41:28.414594986Z    at Azure.Identity.ManagedIdentityCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-07T18:41:28.414598386Z    at Azure.Identity.ManagedIdentityCredential.GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-07T18:41:28.414601786Z    at Azure.Identity.DefaultAzureCredential.GetTokenFromSourcesAsync(TokenCredential[] sources, TokenRequestContext requestContext, Boolean async, CancellationToken cancellationToken)
2022-01-07T18:41:28.414605186Z    at Azure.Identity.DefaultAzureCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-07T18:41:28.414608586Z    at Azure.Identity.CredentialDiagnosticScope.FailWrapAndThrow(Exception ex, String additionalMessage)
2022-01-07T18:41:28.414612486Z    at Azure.Identity.DefaultAzureCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-07T18:41:28.414615886Z    at Azure.Identity.DefaultAzureCredential.GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-07T18:41:28.414619186Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueFromCredentialAsync(TokenRequestContext context, Boolean async, CancellationToken cancellationToken)
2022-01-07T18:41:28.414625186Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueAsync(HttpMessage message, TokenRequestContext context, Boolean async)
2022-01-07T18:41:28.414628686Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueAsync(HttpMessage message, TokenRequestContext context, Boolean async)
2022-01-07T18:41:28.414631986Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AuthenticateAndAuthorizeRequestAsync(HttpMessage message, TokenRequestContext context)
2022-01-07T18:41:28.414635286Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T18:41:28.414638586Z    at Azure.Core.Pipeline.RedirectPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T18:41:28.414641886Z    at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T18:41:28.414645186Z    at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T18:41:28.414648586Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.UserAgentHeaderPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T18:41:28.414651986Z    at Azure.Core.Pipeline.HttpPipeline.SendRequestAsync(Request request, CancellationToken cancellationToken)
2022-01-07T18:41:28.414655285Z    at Azure.Data.AppConfiguration.ConfigurationClient.GetConfigurationSettingsPageAsync(SettingSelector selector, String pageLink, CancellationToken cancellationToken)
2022-01-07T18:41:28.414658685Z    at Azure.Core.PageResponseEnumerator.FuncAsyncPageable`1.AsPages(String continuationToken, Nullable`1 pageSizeHint)+MoveNext()
2022-01-07T18:41:28.414662085Z    at Azure.Core.PageResponseEnumerator.FuncAsyncPageable`1.AsPages(String continuationToken, Nullable`1 pageSizeHint)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
2022-01-07T18:41:28.414666185Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
2022-01-07T18:41:28.414669485Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
2022-01-07T18:41:28.414672685Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
2022-01-07T18:41:28.414676285Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass20_3.<<LoadAll>b__4>d.MoveNext()
2022-01-07T18:41:28.414679885Z --- End of stack trace from previous location ---
2022-01-07T18:41:28.414683185Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass20_3.<<LoadAll>b__4>d.MoveNext()
2022-01-07T18:41:28.414686685Z --- End of stack trace from previous location ---
2022-01-07T18:41:28.414689885Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.TracingUtils.CallWithRequestTracing(Boolean tracingEnabled, RequestType requestType, RequestTracingOptions requestTracingOptions, Func`1 clientCall)
2022-01-07T18:41:28.414695785Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.CallWithRequestTracing(Func`1 clientCall)
2022-01-07T18:41:28.414699185Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.LoadAll(Boolean ignoreFailures)
2022-01-07T18:41:28.414702485Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.Load()
2022-01-07T18:41:28.414705785Z    at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
2022-01-07T18:41:28.414709885Z    at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
2022-01-07T18:41:28.414713285Z    at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
2022-01-07T18:41:28.414716585Z    at Microsoft.Extensions.Hosting.HostBuilder.Build()
2022-01-07T18:41:28.414719785Z    at SMA.HyMon.API.Config.Program.Main(String[] args) in C:\Users\papst\source\repos\HyMon\Hybrid Monitoring Cloud\src\SMA.HyMon.API.Config\Program.cs:line 42
2022-01-07T18:41:28.484618104Z [18:41:28 INF] Application Info: 2.0.56+cbe9899f57, Git: cbe9899f5719b7f0d5915d77275dd19d98804c11, Build: 01/07/2022 11:08:23

Please note the Scope for the Key Vault.

Try 1: With Event Source Listener, only Key Vault
2022-01-07T18:49:31.879661507Z [18:49:31 INF] Starting web host for App SMA.HyMon.API.Config
2022-01-07T18:49:32.533710838Z [18:49:32 INF] Application Info: 2.0.56+cbe9899f57, Git: cbe9899f5719b7f0d5915d77275dd19d98804c11, Build: 01/07/2022 11:08:23
2022-01-07T18:49:36.274465244Z [Informational] Azure-Core: Request [a67be17d-67e2-49bb-8aef-2a9660ce7d9b] GET https://w-hymon-api-dev.vault.azure.net/secrets/?api-version=REDACTED
2022-01-07T18:49:36.274489544Z Accept:REDACTED
2022-01-07T18:49:36.274494344Z x-ms-client-request-id:REDACTED
2022-01-07T18:49:36.274498544Z x-ms-return-client-request-id:REDACTED
2022-01-07T18:49:36.274502744Z User-Agent:REDACTED
2022-01-07T18:49:36.274506743Z Content-Type:REDACTED
2022-01-07T18:49:36.275814134Z client assembly: Azure.Security.KeyVault.Secrets
2022-01-07T18:49:47.550267296Z [Warning] Azure-Core: Error response [a67be17d-67e2-49bb-8aef-2a9660ce7d9b] 401 Unauthorized (11.2s)
2022-01-07T18:49:47.550324196Z Cache-Control:REDACTED
2022-01-07T18:49:47.550336096Z Pragma:REDACTED
2022-01-07T18:49:47.550340696Z WWW-Authenticate:REDACTED
2022-01-07T18:49:47.550350996Z x-ms-keyvault-region:REDACTED
2022-01-07T18:49:47.550354696Z x-ms-client-request-id:REDACTED
2022-01-07T18:49:47.550358196Z x-ms-request-id:REDACTED
2022-01-07T18:49:47.550361796Z x-ms-keyvault-service-version:REDACTED
2022-01-07T18:49:47.559422445Z x-ms-keyvault-network-info:REDACTED
2022-01-07T18:49:47.559442344Z X-Powered-By:REDACTED
2022-01-07T18:49:47.559446744Z Strict-Transport-Security:REDACTED
2022-01-07T18:49:47.559450444Z X-Content-Type-Options:REDACTED
2022-01-07T18:49:47.559454044Z Date:REDACTED
2022-01-07T18:49:47.559457944Z Content-Length:REDACTED
2022-01-07T18:49:47.559461544Z Content-Type:REDACTED
2022-01-07T18:49:47.559465144Z Expires:REDACTED
2022-01-07T18:49:47.559468644Z
2022-01-07T18:49:47.569284789Z [Warning] Azure-Core: Response [a67be17d-67e2-49bb-8aef-2a9660ce7d9b] took 11.2s
2022-01-07T18:49:47.770304254Z [Informational] Azure-Identity: DefaultAzureCredential.GetToken invoked. Scopes: [ https://vault.azure.net/.default ] ParentRequestId: a67be17d-67e2-49bb-8aef-2a9660ce7d9b
2022-01-07T18:49:47.901066316Z [Informational] Azure-Identity: EnvironmentCredential.GetToken invoked. Scopes: [ https://vault.azure.net/.default ] ParentRequestId: a67be17d-67e2-49bb-8aef-2a9660ce7d9b
2022-01-07T18:49:47.939658398Z [Informational] Azure-Identity: EnvironmentCredential.GetToken was unable to retrieve an access token. Scopes: [ https://vault.azure.net/.default ] ParentRequestId: a67be17d-67e2-49bb-8aef-2a9660ce7d9b Exception: Azure.Identity.CredentialUnavailableException (0x80131500): EnvironmentCredential authentication unavailable. Environment variables are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/environmentcredential/troubleshoot
2022-01-07T18:49:48.021030639Z [Informational] Azure-Identity: ManagedIdentityCredential.GetToken invoked. Scopes: [ https://vault.azure.net/.default ] ParentRequestId: a67be17d-67e2-49bb-8aef-2a9660ce7d9b
2022-01-07T18:49:48.060820914Z [Informational] Azure-Core: Request [e377836b-172a-456a-8384-b86581801586] GET http://<IP_ADDRESS>:8081/msi/token?api-version=REDACTED&resource=REDACTED
2022-01-07T18:49:48.060864114Z secret:REDACTED
2022-01-07T18:49:48.069062768Z x-ms-client-request-id:REDACTED
2022-01-07T18:49:48.069080468Z x-ms-return-client-request-id:REDACTED
2022-01-07T18:49:48.069084868Z User-Agent:REDACTED
2022-01-07T18:49:48.069088568Z client assembly: Azure.Identity
2022-01-07T18:49:56.156562734Z [Informational] Azure-Core: Response [e377836b-172a-456a-8384-b86581801586] 200 OK (08.1s)
2022-01-07T18:49:56.156649233Z Date:REDACTED
2022-01-07T18:49:56.156655733Z Server:REDACTED
2022-01-07T18:49:56.156660033Z Transfer-Encoding:REDACTED
2022-01-07T18:49:56.156664233Z Content-Type:REDACTED
2022-01-07T18:49:56.156668333Z
2022-01-07T18:49:56.156756033Z [Warning] Azure-Core: Response [e377836b-172a-456a-8384-b86581801586] took 08.1s
2022-01-07T18:49:56.339270732Z [Informational] Azure-Identity: ManagedIdentityCredential.GetToken succeeded. Scopes: [ https://vault.azure.net/.default ] ParentRequestId: a67be17d-67e2-49bb-8aef-2a9660ce7d9b ExpiresOn: 2022-01-08T18:49:54.0000000+00:00
2022-01-07T18:49:56.348209579Z [Informational] Azure-Identity: DefaultAzureCredential credential selected: Azure.Identity.ManagedIdentityCredential
2022-01-07T18:49:56.348734175Z [Informational] Azure-Identity: DefaultAzureCredential.GetToken succeeded. Scopes: [ https://vault.azure.net/.default ] ParentRequestId: a67be17d-67e2-49bb-8aef-2a9660ce7d9b ExpiresOn: 2022-01-08T18:49:54.0000000+00:00
2022-01-07T18:49:56.387049044Z [Informational] Azure-Core: Request [a67be17d-67e2-49bb-8aef-2a9660ce7d9b] GET https://w-hymon-api-dev.vault.azure.net/secrets/?api-version=REDACTED
2022-01-07T18:49:56.387096644Z Accept:REDACTED
2022-01-07T18:49:56.387101344Z x-ms-client-request-id:REDACTED
2022-01-07T18:49:56.387105144Z x-ms-return-client-request-id:REDACTED
2022-01-07T18:49:56.388277337Z User-Agent:REDACTED
2022-01-07T18:49:56.388290337Z Authorization:REDACTED
2022-01-07T18:49:56.388294337Z Content-Type:REDACTED
2022-01-07T18:49:56.388983133Z client assembly: Azure.Security.KeyVault.Secrets
2022-01-07T18:49:56.479145089Z [Informational] Azure-Core: Response [a67be17d-67e2-49bb-8aef-2a9660ce7d9b] 200 OK (00.1s)
2022-01-07T18:49:56.479169989Z Cache-Control:REDACTED
2022-01-07T18:49:56.479173889Z Pragma:REDACTED
2022-01-07T18:49:56.479176889Z x-ms-keyvault-region:REDACTED
2022-01-07T18:49:56.479179989Z x-ms-client-request-id:REDACTED
2022-01-07T18:49:56.479182889Z x-ms-request-id:REDACTED
2022-01-07T18:49:56.479185689Z x-ms-keyvault-service-version:REDACTED
2022-01-07T18:49:56.479188689Z x-ms-keyvault-network-info:REDACTED
2022-01-07T18:49:56.486654344Z x-ms-keyvault-rbac-assignment-id:REDACTED
2022-01-07T18:49:56.486669744Z x-ms-keyvault-rbac-cache:REDACTED
2022-01-07T18:49:56.486674044Z X-Powered-By:REDACTED
2022-01-07T18:49:56.486677644Z Strict-Transport-Security:REDACTED
2022-01-07T18:49:56.486681144Z X-Content-Type-Options:REDACTED
2022-01-07T18:49:56.486684744Z Date:REDACTED
2022-01-07T18:49:56.486688244Z Content-Type:REDACTED
2022-01-07T18:49:56.486691744Z Expires:REDACTED
2022-01-07T18:49:56.486695244Z Content-Length:REDACTED
2022-01-07T18:49:56.486698844Z
2022-01-07T18:49:56.607497315Z [Informational] Azure-Core: Request [1c5540bb-7c9d-42de-8996-05e6046d7f6b] GET https://w-hymon-api-dev.vault.azure.net/secrets/B2CClient--Secret/?api-version=REDACTED
2022-01-07T18:49:56.607525315Z Accept:REDACTED
2022-01-07T18:49:56.607530315Z x-ms-client-request-id:REDACTED
2022-01-07T18:49:56.607534215Z x-ms-return-client-request-id:REDACTED
2022-01-07T18:49:56.607561115Z User-Agent:REDACTED
2022-01-07T18:49:56.608514409Z Authorization:REDACTED
2022-01-07T18:49:56.608526809Z Content-Type:REDACTED
2022-01-07T18:49:56.608530009Z client assembly: Azure.Security.KeyVault.Secrets
2022-01-07T18:49:56.627870592Z [Informational] Azure-Core: Response [1c5540bb-7c9d-42de-8996-05e6046d7f6b] 200 OK (00.0s)
2022-01-07T18:49:56.627889092Z Cache-Control:REDACTED
2022-01-07T18:49:56.627892892Z Pragma:REDACTED
2022-01-07T18:49:56.627895792Z x-ms-keyvault-region:REDACTED
2022-01-07T18:49:56.627898792Z x-ms-client-request-id:REDACTED
2022-01-07T18:49:56.627901692Z x-ms-request-id:REDACTED
2022-01-07T18:49:56.627904592Z x-ms-keyvault-service-version:REDACTED
2022-01-07T18:49:56.627907392Z x-ms-keyvault-network-info:REDACTED
2022-01-07T18:49:56.629382183Z x-ms-keyvault-rbac-assignment-id:REDACTED
2022-01-07T18:49:56.629404083Z x-ms-keyvault-rbac-cache:REDACTED
2022-01-07T18:49:56.629407683Z X-Powered-By:REDACTED
2022-01-07T18:49:56.629410483Z Strict-Transport-Security:REDACTED
2022-01-07T18:49:56.629413283Z X-Content-Type-Options:REDACTED
2022-01-07T18:49:56.629416083Z Date:REDACTED
2022-01-07T18:49:56.629418883Z Content-Type:REDACTED
2022-01-07T18:49:56.629421583Z Expires:REDACTED
2022-01-07T18:49:56.629424383Z Content-Length:REDACTED
2022-01-07T18:49:56.629427183Z
2022-01-07T18:49:58.045751381Z [18:49:58 INF] Azure Web Sites environment detected. Using '/home/ASP.NET/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
2022-01-07T18:49:59.311248846Z [18:49:59 INF] Now listening on: http://[::]:8080
2022-01-07T18:49:59.361179856Z [18:49:59 INF] Application started. Press Ctrl+C to shut down.
2022-01-07T18:49:59.361990052Z [18:49:59 INF] Hosting environment: Production
2022-01-07T18:49:59.362665448Z [18:49:59 INF] Content root path: /home/site/wwwroot
2022-01-07T18:49:59.542690804Z [18:49:59 INF] Request starting HTTP/1.1 GET http://<IP_ADDRESS>:8080/robots933456.txt - -
2022-01-07T18:49:59.579851189Z [18:49:59 WRN] Failed to determine the https port for redirect.
2022-01-07T18:49:59.862335552Z [18:49:59 ERR] Connection id "0HMEI1Q0OGL44", Request id "0HMEI1Q0OGL44:00000002": An unhandled exception was thrown by the application.
2022-01-07T18:49:59.862399751Z System.ArgumentNullException: IDW10106: The 'ClientId' option must be provided.

For the last one, I needed to remove the dependencies to `Microsoft.Extensions.Configuration.AzureAppConfiguration` (4.5.1) in order not to get the previous exception.
Please note the correct scope for the Key Vault.

The scope for App Configuration should be the full scheme + host name + "/.default" so in cases like scenario 1 it is correct. For Key Vault, it should be (when using AzureCloud i.e. the public cloud) "https://vault.azure.net/.default" so those scenarios like scenario 3 are correct.
So the only scenario that seems to break is scenario 2 with both App Configuration and Key Vault, which, as you pointed out, uses the wrong scope. In fact, what's really confusing is that it's hosting the full hostname for Key Vault but the request seems to be coming from App Configuration:
2022-01-07T18:40:59.178919102Z [Informational] Azure-Identity: DefaultAzureCredential.GetToken invoked. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: 6a11017b-6c04-4734-94d5-e7dbff0ab419
2022-01-07T18:40:59.179353000Z [Informational] Azure-Identity: EnvironmentCredential.GetToken invoked. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: 6a11017b-6c04-4734-94d5-e7dbff0ab419
2022-01-07T18:40:59.219836083Z [Informational] Azure-Identity: EnvironmentCredential.GetToken was unable to retrieve an access token. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: 6a11017b-6c04-4734-94d5-e7dbff0ab419 Exception: Azure.Identity.CredentialUnavailableException (0x80131500): EnvironmentCredential authentication unavailable. Environment variables are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/environmentcredential/troubleshoot
2022-01-07T18:40:59.508454541Z [Informational] Azure-Identity: ManagedIdentityCredential.GetToken invoked. Scopes: [ https://w-hymon-api-dev.vault.azure.net/.default ] ParentRequestId: 6a11017b-6c04-4734-94d5-e7dbff0ab419
2022-01-07T18:41:00.129436023Z [Informational] Azure-Core: Request [88a39a25-e39b-4b2e-930f-7e30527d44e5] GET http://<IP_ADDRESS>:8081/msi/token?api-version=REDACTED&resource=REDACTED
...
2022-01-07T18:41:28.414615886Z    at Azure.Identity.DefaultAzureCredential.GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
2022-01-07T18:41:28.414619186Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueFromCredentialAsync(TokenRequestContext context, Boolean async, CancellationToken cancellationToken)
2022-01-07T18:41:28.414625186Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueAsync(HttpMessage message, TokenRequestContext context, Boolean async)
2022-01-07T18:41:28.414628686Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AccessTokenCache.GetHeaderValueAsync(HttpMessage message, TokenRequestContext context, Boolean async)
2022-01-07T18:41:28.414631986Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.AuthenticateAndAuthorizeRequestAsync(HttpMessage message, TokenRequestContext context)
2022-01-07T18:41:28.414635286Z    at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T18:41:28.414638586Z    at Azure.Core.Pipeline.RedirectPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T18:41:28.414641886Z    at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T18:41:28.414645186Z    at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T18:41:28.414648586Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.UserAgentHeaderPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
2022-01-07T18:41:28.414651986Z    at Azure.Core.Pipeline.HttpPipeline.SendRequestAsync(Request request, CancellationToken cancellationToken)
2022-01-07T18:41:28.414655285Z    at Azure.Data.AppConfiguration.ConfigurationClient.GetConfigurationSettingsPageAsync(SettingSelector selector, String pageLink, CancellationToken cancellationToken)
2022-01-07T18:41:28.414658685Z    at Azure.Core.PageResponseEnumerator.FuncAsyncPageable`1.AsPages(String continuationToken, Nullable`1 pageSizeHint)+MoveNext()
2022-01-07T18:41:28.414662085Z    at Azure.Core.PageResponseEnumerator.FuncAsyncPageable`1.AsPages(String continuationToken, Nullable`1 pageSizeHint)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
2022-01-07T18:41:28.414666185Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
2022-01-07T18:41:28.414669485Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
2022-01-07T18:41:28.414672685Z    at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
2022-01-07T18:41:28.414676285Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass20_3.<<LoadAll>b__4>d.MoveNext()
2022-01-07T18:41:28.414679885Z --- End of stack trace from previous location ---
2022-01-07T18:41:28.414683185Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass20_3.<<LoadAll>b__4>d.MoveNext()
2022-01-07T18:41:28.414686685Z --- End of stack trace from previous location ---
2022-01-07T18:41:28.414689885Z    at Microsoft.Extensions.Configuration.AzureAppConfiguration.TracingUtils.CallWithRequestTracing(Boolean tracingEnabled, RequestType requestType, RequestTracingOptions requestTracingOptions, Func`1 clientCall)

Do you try to access any values during startup outside your 'CreateHostBuilder' method? Looking at the stack trace, it seems (though compiler optimizations may have inlined) the exception is thrown outside this method. I'll try to access some App Configuration values in my sample, as currently I'm just configuring it, then configuring Key Vault (much like you are), and have an endpoint that queries Key Vault.
As for the robots.txt query, those seem to be coming from the App Services host itself, given the prefix matches what they are using for host logs. To my knowledge, we don't have any SDKs that would even care to query robots.txt since we're making REST (or gRPC) calls directly to Azure endpoints.

Would you also be willing to share a process dump with your current changes for scenario 2 above with your support representative for case<PHONE_NUMBER>001183 you mentioned in your OP? I could also get in contact with you over email and provide a OneDrive for Business link I'll have cleaned up within 48hrs, compliant with GDPR. I realize you're in Germany and there's a time difference, but if you get this before Monday and let me know what works for you, I can login early and get a hold of you that way.

I am accessing some const string properties of the Program class (like AppName) - nothing else.
But you pointed on something.. that the scope and the exception is coming from the App Config and that for the app config the scope is the complete url... and after trying that, I am totally sorry - this is a terrible mistake from my side.
For better understanding what is happening here:
I am creating an Uri?-typed variable to hold the parsed Uri for the App Configuration which I am reusing later for the Key Vault.
Despite it looks like it is stored and executed, the code is executed when the Configuration Provider is build, which means that the App Configuration config provider reads the variable endpoint after it is reused for holding the Key Vault endpoint.
That is the reason, the App Configuration tries to get a token for the scope for the Key Vault endpoint.
Thanks for the offer to getting in direct contact. I just dropped you a message on Teams while I was working on the fix, to let you know I am still working on it today.
Shall I close the issue or is this something that could be added as a feature to the App Configuration Library, that checks the validity of the given endpoint?

I'm glad you found it! I see where the variable was getting captured by reference and resolved later. Sorry I failed to see that initially, too. Good find!
As for why you needed to remove the dependency, I'm not sure. In one of my repro attempts I merely commented out any App Configuration-related code but kept he references the same. IF they don't get called, they shouldn't interfere.
I'll go ahead and close this. We have talked about validating endpoints in the past but decided it was a slippery slope, causing problems when we add new cloud environments, for example, as well as support against Azure Stack which would have a entirely customer-driven endpoint domains. But this is a good lesson in watching out for reference captures in delegate-driven configuration I'll pass along so we'll remember to watch for it again if we see behavior like this. I suspected a static cache somewhere but wasn't finding anything like that in the suspected code paths.


Status of the project

Hello,
Is it usable? What's the current status?
It would be nice to have a roadmap and status in the README.md. Could you add it?

i want to know too

I'm sorry that I couldn't reply in time. Due to heavy overtime, I couldn't concentrate on the project.
In the past 22 years, my personal work has changed a lot and I mainly focus on time sequence storage, so my time investment in this project has weakened (overtime work is very serious). Of course, I am also thinking about whether to continue to do independent and complete stream computing or to integrate them, such as the direction of stream database.

There are very good alternatives on streams sql engines like Arroyo. But I'm more interested in a streaming platform like KSttreams from confluent that can run independent composable ms. I'm understand.


command suggestion

add a configurable command option in the config to obtain this book like
BookCommand: "infobook"
^^ by default. for people to obtain that book anytime and maybe add a cooldown??
for my server i would name the command guide so people get it by doing /guide if i changed it to that in the config

@jaylac2000  this plugin is ment for giving books on join maybe I will try to add the feature later now I am busy with my mcpe network and school

all good. i just think its a good idea incase someone loses the book they can get it back via command


Harvester: added link to referral detail on EmailedReferralAdmin, added another DoP trigger name rule to harvest method.

This change is

Changes Unknown when pulling a090faa7041505f7ccb4f5d31b8b23ead02b008b on ropable:master into ** on parksandwildlife:master**.


refactor: construct bucket paths with scheme prefixes

BREAKING CHANGES: GCSPaths must include a path scheme
Before GCSPath would convert /bucket-name/file into gs://bucket-name/file internally. This leads to ambiguity *(thanks @honnibal) when dealing with regular file-system paths and bucket paths together. Does the path /foo/bar point to an absolute file path or a GCS bucket named foo?
Now paths must be constructed with a path scheme. This allows GCSPath to deal with both types of paths, and is needed for the CLI app/s to come.

:tada: This PR is included in version 0.1.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:


Improve function signature of sendPanic

We have a sendPanic function, which we use to report errors.
The code at https://github.com/prisma/prisma2/blob/master/cli/prisma2/src/bin.ts#L167 passes in the package name and package version instead of the cli version and binary version.
We either should fix the signature or change what we pass in.
This has a low priority for now.

The handlePanic or sendPanic functions are correct. It was just not correctly used in bin.ts.


Initial FLE2 work

Uses the latest mongodb-crypt snapshot.
Includes:

AutoEncryptionOptions
EncryptOptions
Updated tests and added explicit prose tests.

https://spruce.mongodb.com/task/mongo_java_driver_tests_jdk_secure__version~4.2_os~linux_topology~replicaset_auth~auth_ssl~ssl_jdk~jdk8_test_patch_5f0cf4b43be0f9e25aa65566238d7e6907f870db_62838a130ae60667d2b881d9_22_05_17_11_42_13/tests?execution=0&sortBy=STATUS&sortDir=ASC looks like a new failure

https://spruce.mongodb.com/task/mongo_java_driver_tests_jdk_secure__version~4.2_os~linux_topology~replicaset_auth~auth_ssl~ssl_jdk~jdk8_test_patch_5f0cf4b43be0f9e25aa65566238d7e6907f870db_62838a130ae60667d2b881d9_22_05_17_11_42_13/tests?execution=0&sortBy=STATUS&sortDir=ASC looks like a new failure

@jyemin Should be fixed now, however, the encryption tests are also failing on 6.0 builds - any idea what version is installed?  Tested locally using 6.0.0-rc5

This indicates rc4

WIll add JAVA-4609 shortly.

@jyemin please review the last commit - added the clustered index and changed the drop order

Manually fixed up / squashed rebased and merged


model diagram gets a border

Description

Include a summary of the changes and the related issue.
Include relevant motivation and context.

Resolves #(issue)

Can you include video/screenshot of changes?


Add function to list all the registered kanister functions

Change Overview
This PR adds a simple function that lists all the kanister functions that registered and can be used in blueprints.
Pull request type
Please check the type of change your PR introduces:

[ ] :construction: Work in Progress
[ ] :rainbow: Refactoring (no functional changes, no api changes)
[x] :hamster: Trivial/Minor
[ ] :bug: Bugfix
[ ] :sunflower: Feature
[ ] :world_map: Documentation
[ ] :robot: Test

Issues

#XXX

Test Plan

[x] :muscle: Manual
[ ] :zap: Unit test
[ ] :green_heart: E2E

Hi @pavannd1,
Like RequiredArgs() []string method for Kanister function type  (type Func interface) I propose to have another method just Arguments() []string that is going to return all the arguments that are supported for a kanister functions.
This would be really helpful to validate blueprints


Condensed list tab for live and upcoming videos

Drop the text and just use the avatar. Aligning the title will at least make it look more uniform.

Updated

Doesn’t make sense to have it as a tab. Need to explore a spot to put a sort/filter button and grid/list button