Closed ZenwalkerD closed 4 months ago
@ZenwalkerD I would expect to see some configuration values in the response, even if not those from Key Vault. ASP.NET infrastructure typically populates a number of them. I suspect that they're just not being output properly; if I use the same code, I also see no configuration values in the response (despite the IConfiguration
instance verified in the debugger to have many values). I suspect that the JSON serializer just doesn't know how to deal with IConfiguration
as it has no properties. If, instead, I use:
return Ok(JsonSerializer.Serialize(_configuration.AsEnumerable()));
I get a response that better matches what I expect. I would look at doing the same and see if your secrets are, in fact, being loaded.
@ZenwalkerD I would expect to see some configuration values in the response, even if not those from Key Vault. ASP.NET infrastructure typically populates a number of them. I suspect that they're just not being output properly; if I use the same code, I also see no configuration values in the response (despite the
IConfiguration
instance verified in the debugger to have many values). I suspect that the JSON serializer just doesn't know how to deal withIConfiguration
as it has no properties. If, instead, I use:return Ok(JsonSerializer.Serialize(_configuration.AsEnumerable()));
I get a response that better matches what I expect. I would look at doing the same and see if your secrets are, in fact, being loaded.
Thank you. It works. My bad :(
Ask your question here
In Azure Container apps; i have configured the Dapr Components and have assigned all System Identity permissions as shown:
In the ASP Net Core WebApi Startup or program.cs i have added below code:
And i have a controller as shown:
if i deploy above app in a container to container apps; it successfully deploys and when i visit/shoot API GET/api/hello
then response is Empty i.e IConfiguration is empty
However; when i remove below line from Program.cs
builder.Configuration.AddDaprSecretStore("keyvault", new DaprClientBuilder().Build(), TimeSpan.FromMinutes(1));
and uncomment below line in Controller Method:
and then deploy. Upon shooting the same endpoint; the keyvault data is loaded and response is correct.
What am i doing wrong? Basically i want the IConfiguraiton to be filled in with all KeyVault data during application start.
.NET 8.0 Dapr.AspNetCore 1.13.1 Dapr.Extensions.Configuration 1.13.1
Thanks