From 27955110a0690408b5de8601a00826fa9e48c20f Mon Sep 17 00:00:00 2001 From: Alexander Pajer Date: Thu, 9 Feb 2023 11:40:11 +0100 Subject: [PATCH] cleanup --- .../demo-01/config-service-api/Config/AppConfig.cs | 4 +--- .../03-app-config/demo-01/config-service-api/Program.cs | 2 +- .../demo-01/config-service-api/appsettings.json | 4 +--- .../03-app-config/demo-01/create-app-conf.azcli | 7 +++++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/demos/07-secure-solutions/03-app-config/demo-01/config-service-api/Config/AppConfig.cs b/demos/07-secure-solutions/03-app-config/demo-01/config-service-api/Config/AppConfig.cs index 07eb672b..ba3b1a6b 100644 --- a/demos/07-secure-solutions/03-app-config/demo-01/config-service-api/Config/AppConfig.cs +++ b/demos/07-secure-solutions/03-app-config/demo-01/config-service-api/Config/AppConfig.cs @@ -2,11 +2,9 @@ public class Settings { public string Title { get; set; } public bool AuthEnabled { get; set; } - public bool UseSQLite { get; set; } - public bool UseAppConfig { get; set; } public string ConnectionString { get; set; } public string KeyVault { get; set; } - public string AppConfig { get; set; } + public string AppConfigEndpoint { get; set; } public string Sentinel { get; set; } } diff --git a/demos/07-secure-solutions/03-app-config/demo-01/config-service-api/Program.cs b/demos/07-secure-solutions/03-app-config/demo-01/config-service-api/Program.cs index 4e2c2897..5e1c48fa 100644 --- a/demos/07-secure-solutions/03-app-config/demo-01/config-service-api/Program.cs +++ b/demos/07-secure-solutions/03-app-config/demo-01/config-service-api/Program.cs @@ -13,7 +13,7 @@ string connectionString = "Endpoint=https://foodconfig-dev.azconfig.io;Id=B1kS-l9-s0:O8WiC3kXo8OKaABKcK4y;Secret=dlCIR0ybMLVX1czEyI9AlaKOcVaINQbZZkkek8uKS88="; builder.Configuration.AddAzureAppConfiguration(options => -{ +{ options.Connect(connectionString) .ConfigureKeyVault(kv => { diff --git a/demos/07-secure-solutions/03-app-config/demo-01/config-service-api/appsettings.json b/demos/07-secure-solutions/03-app-config/demo-01/config-service-api/appsettings.json index bc7b3e32..d0ec6876 100644 --- a/demos/07-secure-solutions/03-app-config/demo-01/config-service-api/appsettings.json +++ b/demos/07-secure-solutions/03-app-config/demo-01/config-service-api/appsettings.json @@ -10,11 +10,9 @@ "AppSettings": { "Title": "App Config From File", "AuthEnabled": false, - "UseSQLite": true, - "UseAppConfig": false, "ConnectionString": "Data Source=./food-local.db", "KeyVault": "foodvault-dev.vault.azure.net", - "AppConfig": "https://foodconfig-dev.azconfig.io", + "AppConfigEndpoint": "https://foodconfig-dev.azconfig.io", "Sentinel": 1 }, "FeatureManagement": { diff --git a/demos/07-secure-solutions/03-app-config/demo-01/create-app-conf.azcli b/demos/07-secure-solutions/03-app-config/demo-01/create-app-conf.azcli index 94963862..2cafa371 100644 --- a/demos/07-secure-solutions/03-app-config/demo-01/create-app-conf.azcli +++ b/demos/07-secure-solutions/03-app-config/demo-01/create-app-conf.azcli @@ -7,7 +7,7 @@ app=config-api-$env plan=config-plan-$env # create appconfig and add a value -az appconfig create -g $grp -n $cfg -l $loc --sku free +appconfigid=$(az appconfig create -g $grp -n $cfg -l $loc --sku free --query id -o tsv) az appconfig kv set -n $cfg --key "Settings:Title" --value "App Config Demo Dev" -y az appconfig kv set -n $cfg --key "Settings:Title" --value "App Config Demo" -y --label production @@ -36,6 +36,9 @@ cd config-service-api az webapp up -n $app -g $grp -p $plan -l $loc --sku Free --runtime "DOTNET|6.0" cd .. webmi=$(az webapp identity assign -g $grp -n $app --query principalId -o tsv) - az keyvault set-policy -n $vault --object-id $webmi --secret-permissions get list + +# add app config reader permissions to managed identity +az role assignment create --role "App Configuration Data Reader" --assignee $webmi --scope $appconfigid + az webapp restart -g $grp -n $app \ No newline at end of file