I am implementing blob trigger azure function in dot net 8. I have added azure app config and key vault configuration. On local, function runs successfully. But when I deploy it, I am getting below error:
2025-01-16T16:51:07.643 [Information] Starting JobHost
2025-01-16T16:51:07.645 [Information] Starting Host (HostId=id-dv-functions, InstanceId=e1561a9e-6000-47fe-9f94-e64cb16c3524, Version=4.1036.3.23284, ProcessId=28164, AppDomainId=1, InDebugMode=True, InDiagnosticMode=False, FunctionsExtensionVersion=~4)
2025-01-16T16:51:07.670 [Information] Loading functions metadata
2025-01-16T16:51:13.014 [Error] Unhandled exception. System.TypeLoadException: Method 'AsPages' in type 'Azure.Data.AppConfiguration.AsyncConditionalPageable' from assembly 'Azure.Data.AppConfiguration, Version=1.4.1.0, Culture=neutral, PublicKeyToken=92742159e12e44c8' does not have an implementation.
2025-01-16T16:51:13.014 [Information] at Azure.Data.AppConfiguration.ConfigurationClient.GetConfigurationSettingsAsync(SettingSelector selector, CancellationToken cancellationToken)
2025-01-16T16:51:13.014 [Information] at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass34_1.<<LoadSelectedKeyValues>b__1>d.MoveNext()
2025-01-16T16:51:13.014 [Information] --- End of stack trace from previous location ---
2025-01-16T16:51:13.014 [Information] at Microsoft.Extensions.Configuration.AzureAppConfiguration.TracingUtils.CallWithRequestTracing(Boolean tracingEnabled, RequestType requestType, RequestTracingOptions requestTracingOptions, Func`1 clientCall)
2025-01-16T16:51:13.014 [Information] at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.LoadSelectedKeyValues(ConfigurationClient client, CancellationToken cancellationToken)
2025-01-16T16:51:13.016 [Information] at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass33_0.<<InitializeAsync>b__0>d.MoveNext()
2025-01-16T16:51:13.017 [Information] --- End of stack trace from previous location ---
2025-01-16T16:51:13.017 [Error] at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass46_0.<<ExecuteWithFailOverPolicyAsync>b__0>d.MoveNext()
2025-01-16T16:51:13.017 [Information] --- End of stack trace from previous location ---
2025-01-16T16:51:13.017 [Error] at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.ExecuteWithFailOverPolicyAsync[T]
2025-01-16T16:51:13.017 [Error] at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.ExecuteWithFailOverPolicyAsync(IEnumerable`1 clients, Func`2 funcToExecute, CancellationToken cancellationToken)
2025-01-16T16:51:13.017 [Information] at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.InitializeAsync(IEnumerable`1 clients, CancellationToken cancellationToken)
2025-01-16T16:51:13.017 [Information] at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.TryInitializeAsync(IEnumerable`1 clients, List`1 startupExceptions, CancellationToken cancellationToken)
2025-01-16T16:51:13.017 [Error] at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.LoadAsync(Boolean ignoreFailures, CancellationToken cancellationToken)
2025-01-16T16:51:13.017 [Information] at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.Load()
2025-01-16T16:51:13.017 [Information] at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
2025-01-16T16:51:13.017 [Information] at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
2025-01-16T16:51:13.017 [Information] at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
2025-01-16T16:51:13.017 [Information] at Microsoft.Extensions.Hosting.HostBuilder.Build()
2025-01-16T16:51:13.017 [Information] at Identifi.CareFunctions.Functions.Program.Main()
Program.cs
public static void Main()
{
var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.ConfigureServices(services =>
{
var appSettingsAssemblies = new[]
{
typeof(IdpSettings).Assembly
};
var types = (from assembly in appSettingsAssemblies
from type in assembly.GetTypes()
where !type.IsAbstract && type.IsClass && typeof(ICareNoteAppSettings).IsAssignableFrom(type)
select type).ToList();
var config = services.BuildServiceProvider().GetService<IConfiguration>();
foreach (var type in types)
{
var settingObj = Activator.CreateInstance(type);
config.Bind(type.Name, settingObj);
services.AddSingleton(type, settingObj);
}
services.AddHttpClient<IResourceOwnerTokenService, ResourceOwnerTokenService>();
services.AddHttpClient<ICareNoteService, CareNoteService>();
})
.ConfigureAppConfiguration((ctx, configurationBuilder) =>
{
configurationBuilder.AddAzureAppConfiguration(option => option.Connect(new Uri(Environment.GetEnvironmentVariable("ConfigurationStoreUrl")), new ManagedIdentityCredential()));
var secretClient = new SecretClient(
new Uri(Environment.GetEnvironmentVariable("KeyStoreUrl")),
new ManagedIdentityCredential());
configurationBuilder.AddAzureKeyVault(secretClient, new KeyVaultSecretManager());
})
.Build();
host.Run();
}
Could you please help me to resolve this issue?