Using entire json in Azure container apps secrets

Jan Sr 0 Reputation points
2024-03-15T10:44:18.2466667+00:00

Hi all,

I have an asp.net 8 application and using configuration system of asp.net.

This app is hosted in azure container apps. There are used secrets and via environment variables are passed configuration to asp.net configuration (options) system.

For example when having json configuration like this:

{
  "DatabaseSettings": {
    "DBProvider": "",
    "ConnectionStringCatalog": ""
  }
}

then using following environment variable to map connection string: DatabaseSettings__ConnectionStringCatalog

I would like to be able to use entire json in environment variable. For example use environment variable name DatabaseSettings and pass there a json value via secret.

Thank you

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,346 questions
Azure Container Apps
Azure Container Apps
An Azure service that provides a general-purpose, serverless container platform.
327 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 60,386 Reputation points
    2024-03-17T15:43:57.0933333+00:00

    There is no builtin support, but you can create a custom configuration provider.

    https://video2.skills-academy.com/en-us/dotnet/core/extensions/custom-configuration-provider

    0 comments No comments