You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-app-configuration/howto-integrate-azure-managed-service-identity.md
+32-32Lines changed: 32 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,41 +132,41 @@ To set up a managed identity in the portal, you first create an application and
132
132
133
133
1. To use both App Configuration values and Key Vault references, update *Program.cs* as shown below. This code creates a new `KeyVaultClient` using an `AzureServiceTokenProvider` and passes this reference to a call to the `UseAzureKeyVault` method.
134
134
135
-
### [.NET Core 2.x](#tab/core2x)
135
+
### [.NET Core 2.x](#tab/core2x)
136
136
137
-
```csharp
138
-
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
AzureServiceTokenProvider azureServiceTokenProvider = new AzureServiceTokenProvider();
161
+
KeyVaultClient kvClient = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback));
162
+
163
+
config.AddAzureAppConfiguration(options => options.Connect(new Uri(settings["AppConfig:Endpoint"]), new ManagedIdentityCredential()).UseAzureKeyVault(kvClient));
164
+
})
165
+
.UseStartup<Startup>());
166
+
```
167
+
---
168
168
169
-
You can now access Key Vault references just like any other App Configuration key. The config provider will use the `KeyVaultClient` that you configured to authenticate to Key Vault and retrieve the value.
169
+
You can now access Key Vault references just like any other App Configuration key. The config provider will use the `KeyVaultClient` that you configured to authenticate to Key Vault and retrieve the value.
0 commit comments