Skip to content

Commit bfe78bc

Browse files
committed
Updates
1 parent 87386f9 commit bfe78bc

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

aspnetcore/blazor/security/account-confirmation-and-password-recovery.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ To create a key vault and set a secret, see [About Azure Key Vault secrets (Azur
8383
* Only the **Get** secret permission is required.
8484
* Select the application as the **Principal** for the secret.
8585

86+
Confirm in the Azure or Entra portal that the app has been granted access to the secret that you created for the email provider key.
87+
8688
> [!IMPORTANT]
8789
> A key vault secret is created with an expiration date. Be sure to track when a key vault secret is going to expire and create a new secret for the app prior to that date passing.
8890
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.
@@ -140,23 +142,18 @@ if (!context.HostingEnvironment.IsDevelopment())
140142
}
141143
```
142144

143-
In the `AzureAd` section of `appsettings.json`, add the following `VaultUri` and `SecretName` configuration keys and values:
145+
In the `AzureAd` section of `appsettings.json` in the server project, confirm the presence of the app's Entra ID `TenantId` and add the following `VaultUri` configuration key and value if `VaultUri` configuration isn't already present:
144146

145147
```json
146-
"VaultUri": "{VAULT URI}",
147-
"SecretName": "{SECRET NAME}"
148+
"VaultUri": "{VAULT URI}"
148149
```
149150

150-
In the preceding example:
151-
152-
* The `{VAULT URI}` placeholder is the key vault URI. Include the trailing slash on the URI.
153-
* The `{SECRET NAME}` placeholder is the secret name.
151+
In the preceding example, the `{VAULT URI}` placeholder is the key vault URI. Include the trailing slash on the URI.
154152

155153
Example:
156154

157155
```json
158-
"VaultUri": "https://contoso.vault.azure.net/",
159-
"SecretName": "BlazorWebAppEntra"
156+
"VaultUri": "https://contoso.vault.azure.net/"
160157
```
161158

162159
Configuration is used to facilitate supplying dedicated key vaults and secret names based on the app's environmental configuration files. For example, you can supply different configuration values for `appsettings.Development.json` in development, `appsettings.Staging.json` when staging, and `appsettings.Production.json` for the production deployment. For more information, see <xref:blazor/fundamentals/configuration>.

aspnetcore/blazor/security/webassembly/standalone-with-identity/account-confirmation-and-password-recovery.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,22 @@ To create a key vault and set a secret, see [About Azure Key Vault secrets (Azur
9090
* Only the **Get** secret permission is required.
9191
* Select the application as the **Principal** for the secret.
9292

93+
Confirm in the Azure or Entra portal that the app has been granted access to the secret that you created for the email provider key.
94+
9395
> [!IMPORTANT]
9496
> A key vault secret is created with an expiration date. Be sure to track when a key vault secret is going to expire and create a new secret for the app prior to that date passing.
9597
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.
9698

99+
Add the following packages to the server project:
100+
101+
* [`Azure.Identity`](https://www.nuget.org/packages/Azure.Identity)
102+
* [`Azure.Security.KeyVault.Secrets`](https://www.nuget.org/packages/Azure.Security.KeyVault.Secrets)
103+
104+
Add the following `AzureHelper` class to the project.
105+
97106
`Helpers/AzureHelper.cs`:
98107

99108
```csharp
100-
using Azure;
101109
using Azure.Identity;
102110
using Azure.Security.KeyVault.Secrets;
103111

@@ -147,23 +155,25 @@ if (!context.HostingEnvironment.IsDevelopment())
147155
}
148156
```
149157

150-
In the `AzureAd` section of `appsettings.json`, add the following `VaultUri` and `SecretName` configuration keys and values:
158+
In the `AzureAd` section, which you may need to add if it isn't already present, of `appsettings.json` in the server project, add the following `TenantId` and `VaultUri` configuration keys and values if they aren't already present:
151159

152160
```json
153-
"VaultUri": "{VAULT URI}",
154-
"SecretName": "{SECRET NAME}"
161+
"AzureAd": {
162+
"TenantId": "{TENANT ID}",
163+
"VaultUri": "{VAULT URI}"
164+
}
155165
```
156166

157167
In the preceding example:
158168

169+
* The `{TENANT ID}` placeholder is the app's tenant ID in Azure.
159170
* The `{VAULT URI}` placeholder is the key vault URI. Include the trailing slash on the URI.
160-
* The `{SECRET NAME}` placeholder is the secret name.
161171

162172
Example:
163173

164174
```json
165-
"VaultUri": "https://contoso.vault.azure.net/",
166-
"SecretName": "BlazorWebAppEntra"
175+
"TenantId": "00001111-aaaa-2222-bbbb-3333cccc4444",
176+
"VaultUri": "https://contoso.vault.azure.net/"
167177
```
168178

169179
Configuration is used to facilitate supplying dedicated key vaults and secret names based on the app's environmental configuration files. For example, you can supply different configuration values for `appsettings.Development.json` in development, `appsettings.Staging.json` when staging, and `appsettings.Production.json` for the production deployment. For more information, see <xref:blazor/fundamentals/configuration>.

0 commit comments

Comments
 (0)