Home > Software design >  Retrieve provider information from IConfiguration
Retrieve provider information from IConfiguration

Time:12-06

I have an Azure Function I'm trying to retrieve the data from a provider located within IConfiguration, the issue is no matter how I approach this I'm unable to extract the data.

Below is how the data is structured in the IConfiguration

enter image description here

This information initially lives inside an App Configuration resource in Azure and it's loaded in via run time.

I have tried:

var azureAppConfigurationData = _configuration.GetSection("AzureAppConfigurationProvider");
var azureAppConfigurationData = _configuration.GetValue<string,string>("AzureAppConfigurationProvider:Data");
var azureAppConfigurationData = _configuration.GetValue<object>("AzureAppConfigurationProvider:Data");

However, each result in null

I'm trying to extract the clientId, clientSecret and the tenantId which is then passed into the Microsoft Graph SDK to communicate with Azure B2C

CodePudding user response:

There are many ways to do this, however, the simplest (without creating a concrete class) would be just to reference the Config Item directly

var clientId = _configuration["UserManagement:Settings:B2CClient:ClientId"]

Assuming, I have typed this correctly

  • Related