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
## Protect keys with Azure Key Vault (`ProtectKeysWithAzureKeyVault`)
38
38
@@ -44,7 +44,7 @@ az login
44
44
45
45
For more information, see [Sign-in to Azure using developer tooling](/dotnet/azure/sdk/authentication/local-development-dev-accounts#sign-in-to-azure-using-developer-tooling).
46
46
47
-
When establishing the key vault in the Entra or Azure portal:
47
+
When [establishing the key vault in the Entra or Azure portal](/azure/key-vault/general/quick-create-portal):
48
48
49
49
* Configure the key vault to use Azure role-based access control (RABC). If you aren't operating on an [Azure Virtual Network](/azure/virtual-network/virtual-networks-overview), including for local development and testing, confirm that public access on the **Networking** step is **enabled** (checked). Enabling public access only exposes the key vault endpoint. Authenticated accounts are still required for access.
50
50
@@ -63,6 +63,8 @@ To configure the Azure Key Vault provider, call one of the <xref:Microsoft.AspNe
63
63
64
64
For more information on the Azure SDK's API and authentication, see [Authenticate .NET apps to Azure services using the Azure Identity library](/dotnet/azure/sdk/authentication/) and [Provide access to Key Vault keys, certificates, and secrets with Azure role-based access control](/azure/key-vault/general/rbac-guide?tabs=azure-cli). For logging guidance, see [Logging with the Azure SDK for .NET: Logging without client registration](/dotnet/azure/sdk/logging#logging-without-client-registration). For apps using dependency injection, an app can call <xref:Microsoft.Extensions.Azure.AzureClientServiceCollectionExtensions.AddAzureClientsCore%2A>, passing `true` for `enableLogForwarding`, to create and wire up the logging infrastructure.
65
65
66
+
To create a key in the Azure portal, see [Quickstart: Set and retrieve a key from Azure Key Vault using the Azure portal](/azure/key-vault/keys/quick-create-portal). Give the key at least `Get`, `Unwrap Key`, and `Wrap Key` permissions. Record the key identifier for use with the app's configuration. If you plan to enable automatic rotation of the key vault key, record the *versionless* key identifier, where no key GUID is placed at the end of the identifier (example: `https://contoso.vault.azure.net/keys/data-protection`).
67
+
66
68
In the `Program` file where services are registered:
`{BLOB URI}`: Full URI to the key file. The URI is generated by Azure Storage when you create the key file. Do not use a SAS.
102
104
103
-
`{KEY IDENTIFIER}`: Azure Key Vault key identifier used for key encryption. An access policy allows the application to access the key vault with `Get`, `Unwrap Key`, and `Wrap Key` permissions. The version of the key is obtained from the key in the Entra or Azure portal after it's created. If you enable automatic rotation of the key vault key, make sure that you use a versionless key identifier in the app's key vault configuration, where no key GUID is placed at the end of the identifier (example: `https://contoso.vault.azure.net/keys/data-protection`).
105
+
`{KEY IDENTIFIER}`: Azure Key Vault key identifier used for key encryption. An access policy allows the application to access the key vault with `Get`, `Unwrap Key`, and `Wrap Key` permissions. The version of the key is obtained from the key in the Entra or Azure portal after it's created. If you enable automatic rotation of the key vault key, make sure that you use a *versionless* key identifier in the app's key vault configuration, where no key GUID is placed at the end of the identifier (example: `https://contoso.vault.azure.net/keys/data-protection`).
104
106
105
107
For an app to communicate and authorize itself with Azure Key Vault, the [`Azure.Identity` NuGet package](https://www.nuget.org/packages/Azure.Identity/) must be referenced by the app.
106
108
@@ -380,7 +382,7 @@ az login
380
382
381
383
Formoreinformation, see [Sign-intoAzureusingdevelopertooling](/dotnet/azure/sdk/authentication/local-development-dev-accounts#sign-in-to-azure-using-developer-tooling).
*ConfigurethekeyvaulttouseAzurerole-basedaccesscontrol (RABC). Ifyouaren't operating on an [Azure Virtual Network](/azure/virtual-network/virtual-networks-overview), including for local development and testing, confirm that public access on the **Networking** step is **enabled** (checked). Enabling public access only exposes the key vault endpoint. Authenticated accounts are still required for access.
386
388
@@ -399,6 +401,8 @@ To configure the Azure Key Vault provider, call one of the <xref:Microsoft.AspNe
399
401
400
402
FormoreinformationontheAzureSDK'sAPIandauthentication, see [Authenticate .NET apps to Azure services using the Azure Identity library](/dotnet/azure/sdk/authentication/) and [ProvideaccesstoKeyVaultkeys, certificates, andsecretswithAzurerole-basedaccesscontrol](/azure/key-vault/general/rbac-guide?tabs=azure-cli). Forloggingguidance, see [LoggingwiththeAzureSDKfor .NET:Loggingwithoutclientregistration](/dotnet/azure/sdk/logging#logging-without-client-registration). Forappsusingdependencyinjection, anappcancall<xref:Microsoft.Extensions.Azure.AzureClientServiceCollectionExtensions.AddAzureClientsCore%2A>, passing `true` for `enableLogForwarding`, tocreateandwireupthelogginginfrastructure.
401
403
404
+
TocreateakeyintheAzureportal, see [Quickstart: SetandretrieveakeyfromAzureKeyVaultusingtheAzureportal](/azure/key-vault/keys/quick-create-portal). Givethekeyatleast `Get`, `UnwrapKey`, and `WrapKey` permissions. Recordthekeyidentifierforusewiththeapp's configuration. If you plan to enable automatic rotation of the key vault key, record the *versionless* key identifier, where no key GUID is placed at the end of the identifier (example: `https://contoso.vault.azure.net/keys/data-protection`).
405
+
402
406
Inthe `Program` filewhereservicesareregistered:
403
407
404
408
```csharp
@@ -436,7 +440,7 @@ services.AddDataProtection()
436
440
437
441
`{BLOBURI}`:FullURItothekeyfile. TheURIisgeneratedbyAzureStorage when you create the key file. Do not use a SAS.
438
442
439
-
`{KEYIDENTIFIER}`:AzureKeyVaultkeyidentifierusedforkeyencryption. Anaccesspolicyallowstheapplicationtoaccessthekeyvaultwith `Get`, `UnwrapKey`, and `WrapKey` permissions. TheversionofthekeyisobtainedfromthekeyintheEntraorAzureportalafterit'screated. Ifyouenableautomaticrotationofthekeyvaultkey, makesurethatyouuseaversionlesskeyidentifierintheapp's key vault configuration, where no key GUID is placed at the end of the identifier (example: `https://contoso.vault.azure.net/keys/data-protection`).
443
+
`{KEYIDENTIFIER}`:AzureKeyVaultkeyidentifierusedforkeyencryption. Anaccesspolicyallowstheapplicationtoaccessthekeyvaultwith `Get`, `UnwrapKey`, and `WrapKey` permissions. TheversionofthekeyisobtainedfromthekeyintheEntraorAzureportalafterit'screated. Ifyouenableautomaticrotationofthekeyvaultkey, makesurethatyouusea*versionless*keyidentifierintheapp's key vault configuration, where no key GUID is placed at the end of the identifier (example: `https://contoso.vault.azure.net/keys/data-protection`).
440
444
441
445
ForanapptocommunicateandauthorizeitselfwithAzureKeyVault, the [`Azure.Identity` NuGetpackage](https://www.nuget.org/packages/Azure.Identity/) must be referenced by the app.
0 commit comments