Azure blob configuration provider implementation for Microsoft.Extensions.Configuration.
Configuration = new ConfigurationBuilder()
.AddBlobJson(new BlobJsonConfigurationOption
{
BlobUri = "https://qinezh.blob.core.windows.net/config/appsettings.json",
IsPublic = false,
ReloadOnChange = true,
LogReloadException = e => logger.LogError(e, e.Message),
ActionOnReload = () => logger.LogInformation("Reloaded.")
})
.Build();
As this demo web app is using MSI to access azure storage, you need below steps before running it:
- Add your user to the Data Reader / Data Contributor role on the appropriate resource
NOTE: To access blob by MSI, it's not enough for the app and account to be added as owners, you need go to your storage account > IAM > Add role and add the special permission for this type of request, STORAGE BLOB DATA CONTRIBUTOR (PREVIEW)
- Login to the Azure CLI as the user, and make sure to select the right subscription. Or if you're using Visual Studio 2017, you could go to Tools -> Options -> Azure Service Authentication and authenticate there.