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/account-confirmation-and-password-recovery.md
+6-9Lines changed: 6 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,8 @@ To create a key vault and set a secret, see [About Azure Key Vault secrets (Azur
83
83
* Only the **Get** secret permission is required.
84
84
* Select the application as the **Principal** for the secret.
85
85
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
+
86
88
> [!IMPORTANT]
87
89
> 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.
88
90
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())
140
142
}
141
143
```
142
144
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:
144
146
145
147
```json
146
-
"VaultUri": "{VAULT URI}",
147
-
"SecretName": "{SECRET NAME}"
148
+
"VaultUri": "{VAULT URI}"
148
149
```
149
150
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.
154
152
155
153
Example:
156
154
157
155
```json
158
-
"VaultUri": "https://contoso.vault.azure.net/",
159
-
"SecretName": "BlazorWebAppEntra"
156
+
"VaultUri": "https://contoso.vault.azure.net/"
160
157
```
161
158
162
159
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>.
Copy file name to clipboardExpand all lines: aspnetcore/blazor/security/webassembly/standalone-with-identity/account-confirmation-and-password-recovery.md
+17-7Lines changed: 17 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,14 +90,22 @@ To create a key vault and set a secret, see [About Azure Key Vault secrets (Azur
90
90
* Only the **Get** secret permission is required.
91
91
* Select the application as the **Principal** for the secret.
92
92
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
+
93
95
> [!IMPORTANT]
94
96
> 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.
95
97
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.
Add the following `AzureHelper` class to the project.
105
+
97
106
`Helpers/AzureHelper.cs`:
98
107
99
108
```csharp
100
-
usingAzure;
101
109
usingAzure.Identity;
102
110
usingAzure.Security.KeyVault.Secrets;
103
111
@@ -147,23 +155,25 @@ if (!context.HostingEnvironment.IsDevelopment())
147
155
}
148
156
```
149
157
150
-
In the `AzureAd` sectionof `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:
151
159
152
160
```json
153
-
"VaultUri": "{VAULT URI}",
154
-
"SecretName": "{SECRET NAME}"
161
+
"AzureAd": {
162
+
"TenantId": "{TENANT ID}",
163
+
"VaultUri": "{VAULT URI}"
164
+
}
155
165
```
156
166
157
167
In the preceding example:
158
168
169
+
* The `{TENANT ID}` placeholder is the app's tenant ID in Azure.
159
170
* 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.
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