Bot packages incompatibility with Azure Key Vault
See original GitHub issueVersion
4.7.0
Describe the bug
When adding Microsoft.Bot.Builder
package to a working ASP.NET Core 3.1 app using Azure Key Vault make the app crash since Microsoft.IdentityModel.Clients.ActiveDirectory.Platform
package cannot be found. This package doesn’t exist anymore, something in the required packages of Microsoft.Bot.Builder
should be wrong.
To Reproduce
-
clone the project on https://github.com/nimbusparis/TestAKVWithBot
-
Remove the package
Microsoft.Bot.Builder
from the project -
Deploy under Linux
-
Deploy a Azure Certificate on the server
-
Run the app, it should work.
-
Restore the package
Microsoft.Bot.Builder
in the project -
Run the app
-
It crash with the following stack: `Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.IdentityModel.Clients.ActiveDirectory.Platform, Version=3.14.2.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35’. The system cannot find the file specified.
File name: ‘Microsoft.IdentityModel.Clients.ActiveDirectory.Platform, Version=3.14.2.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35’
at Microsoft.Extensions.Configuration.AzureKeyVault.AzureKeyVaultConfigurationOptions.GetTokenFromClientCertificate(String authority, String resource, String clientId, X509Certificate2 certificate)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.Extensions.Configuration.AzureKeyVault.AzureKeyVaultConfigurationOptions.GetTokenFromClientCertificate(String authority, String resource, String clientId, X509Certificate2 certificate)
at Microsoft.Extensions.Configuration.AzureKeyVault.AzureKeyVaultConfigurationOptions.<>c__DisplayClass1_0.<.ctor>b__0(String authority, String resource, String scope)
at Microsoft.Azure.KeyVault.KeyVaultCredential.PostAuthenticate(HttpResponseMessage response)
at Microsoft.Azure.KeyVault.KeyVaultCredential.ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Azure.KeyVault.KeyVaultClient.GetSecretsWithHttpMessagesAsync(String vaultBaseUrl, Nullable1 maxresults, Dictionary
2 customHeaders, CancellationToken cancellationToken)
at Microsoft.Azure.KeyVault.KeyVaultClientExtensions.GetSecretsAsync(IKeyVaultClient operations, String vaultBaseUrl, Nullable1 maxresults, CancellationToken cancellationToken) at Microsoft.Extensions.Configuration.AzureKeyVault.AzureKeyVaultConfigurationProvider.LoadAsync() at Microsoft.Extensions.Configuration.AzureKeyVault.AzureKeyVaultConfigurationProvider.Load() at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList
1 providers)
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at TestAKVWithBot.Program.Main(String[] args) in /opt/TestAKVWithBot/TestAKVWithBot/Program.cs:line 17
`
Expected behavior
Bot Builder should work with Azure Key Vault, not asking an obsolete library.
Additional context
This occurs on Linux when using Certificates to access to AKV.
[bug]
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (12 by maintainers)
Top GitHub Comments
There is a preview of replacement: https://www.nuget.org/packages/Azure.Extensions.Configuration.Secrets/1.0.0-preview.1
But we are not GAing it this month.
Thanks @nimbusparis
We should be able to keep this open until the packages are updated.
Jan 28th we were informed here https://github.com/Azure/azure-sdk-for-net/issues/7457#issuecomment-579539881 the
Microsoft.IdentityModel.Clients.ActiveDirectory
dependency inMicrosoft.Azure.Services.AppAuthentication
should be updated “within the next couple of weeks” After this rolls out,Microsoft.Extensions.Configuration.AzureKeyVault
will need to be updated to use it. (Edit: bot builder will not need an update, since it is already using the latest version of the library causing this).