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: aspnetcore/blazor/security/blazor-web-app-with-entra.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,11 +124,11 @@ Execute the following command in a command shell from the server project's direc
124
124
dotnet user-secrets set "AzureAd:ClientSecret" "{SECRET}"
125
125
```
126
126
127
-
If using Visual Studio, you can confirm the secret is set by right-clicking the server project in **Solution Explorer** and selecting **Manage User Secrets**.
127
+
If using Visual Studio, you can confirm that the secret is set by right-clicking the server project in **Solution Explorer** and selecting **Manage User Secrets**.
128
128
129
129
### Azure Key Vault
130
130
131
-
[Azure Key Vault](https://azure.microsoft.com/products/key-vault/) provides a safe approach for providing the app's client secret to the app when hosting in [Microsoft Azure](https://azure.microsoft.com/).
131
+
[Azure Key Vault](https://azure.microsoft.com/products/key-vault/) provides a safe approach for providing the app's client secret to the app.
132
132
133
133
To create a key vault and set a client secret, see [About Azure Key Vault secrets (Azure documentation)](/azure/key-vault/secrets/about-secrets), which cross-links resources to get started with Azure Key Vault. To implement the code in this section, record the key vault URI and the secret name from Azure when you create the key vault and secret. When you set the access policy for the secret in the **Access policies** panel:
134
134
@@ -137,7 +137,7 @@ To create a key vault and set a client secret, see [About Azure Key Vault secret
137
137
138
138
The following `GetKeyVaultSecret` method retrieves a secret from a key vault. Add this method to the server project. Adjust the namespace (`BlazorSample.Helpers`) to match your project namespace scheme. If you aren't using Visual Studio, you can use the [Secret Manager tool](#secret-manager-tool) locally to store the secret and use the approach in this section in staging/production when the app is deployed.
139
139
140
-
`Helpers/AzureHelper`:
140
+
`Helpers/AzureHelper.cs`:
141
141
142
142
```csharp
143
143
usingAzure;
@@ -191,16 +191,18 @@ if (!context.HostingEnvironment.IsDevelopment())
191
191
}
192
192
```
193
193
194
-
In the `AzureAd` section of `appsettings.json`, add the following configuration keys and values:
195
-
196
-
* The `{VAULT URI}` placeholder is the key vault URI. Include the trailing slash on the URI.
197
-
* The `{SECRET NAME}` placeholder is the secret name.
194
+
In the `AzureAd` section of `appsettings.json`, add the following `VaultUri` and `SecretName` configuration keys and values:
198
195
199
196
```json
200
197
"VaultUri": "{VAULT URI}",
201
198
"SecretName": "{SECRET NAME}"
202
199
```
203
200
201
+
In the preceding example:
202
+
203
+
* The `{VAULT URI}` placeholder is the key vault URI. Include the trailing slash on the URI.
204
+
* The `{SECRET NAME}` placeholder is the secret name.
0 commit comments