Code Ratchet
Code Ratchet

Reputation: 6029

Retrieve provider information from IConfiguration

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

Upvotes: 0

Views: 150

Answers (1)

TheGeneral
TheGeneral

Reputation: 81513

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

Upvotes: 1

Related Questions