Azure.Extensions.AspNetCore.DataProtection.Blobs
1.3.2
dotnet add package Azure.Extensions.AspNetCore.DataProtection.Blobs --version 1.3.2
NuGet\Install-Package Azure.Extensions.AspNetCore.DataProtection.Blobs -Version 1.3.2
<PackageReference Include="Azure.Extensions.AspNetCore.DataProtection.Blobs" Version="1.3.2" />
paket add Azure.Extensions.AspNetCore.DataProtection.Blobs --version 1.3.2
#r "nuget: Azure.Extensions.AspNetCore.DataProtection.Blobs, 1.3.2"
// Install Azure.Extensions.AspNetCore.DataProtection.Blobs as a Cake Addin
#addin nuget:?package=Azure.Extensions.AspNetCore.DataProtection.Blobs&version=1.3.2
// Install Azure.Extensions.AspNetCore.DataProtection.Blobs as a Cake Tool
#tool nuget:?package=Azure.Extensions.AspNetCore.DataProtection.Blobs&version=1.3.2
Azure Storage Blob Key Store for Microsoft.AspNetCore.DataProtection
The Azure.Extensions.AspNetCore.DataProtection.Blobs
package allows storing ASP.NET Core DataProtection keys in Azure Blob Storage. Keys can be shared across several instances of a web app. Apps can share authentication cookies or CSRF protection across multiple servers.
Getting started
Install the package
Install the package with NuGet:
dotnet add package Azure.Extensions.AspNetCore.DataProtection.Blobs
Prerequisites
You need an Azure subscription, Storage Account and Storage Container to use this package.
To create a new Storage Account, you can use the Azure Portal, Azure PowerShell, or the Azure CLI. Here's an example using the Azure CLI:
az storage account create --name <storage-account> --resource-group <resource-group> --location westus --sku Standard_LRS
az storage container create --account-name <storage-account> -n <container>
# Give write access to a user
az role assignment create --role "Storage Blob Data Contributor" --assignee <your_email> --scope "/subscriptions/<subscription>/resourceGroups/<resource-group>/providers/Microsoft.Storage/storageAccounts/<storage-account>/blobServices/default/containers/<container>"
# OR give write access to a service principal (application)
az role assignment create --role "Storage Blob Data Contributor" --assignee-object-id <application_id> --scope "/subscriptions/<subscription>/resourceGroups/<resource-group>/providers/Microsoft.Storage/storageAccounts/<storage-account>/blobServices/default/containers/<container>"
Key concepts
Thread safety
We guarantee that all client instance methods are thread-safe and independent of each other (guideline). This ensures that the recommendation of reusing client instances is always safe, even across threads.
Additional concepts
Client options | Accessing the response | Long-running operations | Handling failures | Diagnostics | Mocking | Client lifetime
Examples
To enable persisting keys to Azure Blob Storage call the PersistKeysToAzureBlobStorage
method. The Uri
provided has to be a blob URI in the following form https://{storage_account}.blob.core.windows.net/{container}/{blob}
.
public void ConfigureServices(IServiceCollection services)
{
services
.AddDataProtection()
.PersistKeysToAzureBlobStorage(new Uri("<full-blob-URI>"), new DefaultAzureCredential());
}
The Azure Identity library provides easy Azure Active Directory support for authentication.
Authenticating using a connection string
public void ConfigureServices(IServiceCollection services)
{
services
.AddDataProtection()
.PersistKeysToAzureBlobStorage("<connection string>", "<container name>", "<blob name>");
}
Next steps
Read more about DataProtection in ASP.NET Core.
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit cla.microsoft.com.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 net481 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETStandard 2.0
- Azure.Core (>= 1.30.0)
- Azure.Storage.Blobs (>= 12.13.1)
- Microsoft.AspNetCore.DataProtection (>= 3.1.32)
NuGet packages (18)
Showing the top 5 NuGet packages that depend on Azure.Extensions.AspNetCore.DataProtection.Blobs:
Package | Downloads |
---|---|
Indice.AspNetCore
Package Description |
|
OrchardCore.DataProtection.Azure
Orchard Core Framework is an application framework for building modular, multi-tenant applications on ASP.NET Core. Provides Azure Blob Storage for data protection key rings. |
|
Aguacongas.IdentityServer.KeysRotation
TheIdServer signing keys rotation. |
|
Jeebs.Apps
Jeebs.Apps library |
|
Pat.DataProtection
Purplebricks data protection mechanism to support encryption and decryption of messages |
GitHub repositories (11)
Showing the top 5 popular GitHub repositories that depend on Azure.Extensions.AspNetCore.DataProtection.Blobs:
Repository | Stars |
---|---|
bitwarden/server
The core infrastructure backend (API, database, Docker, etc).
|
|
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
|
|
nopSolutions/nopCommerce
ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
|
|
dodyg/practical-aspnetcore
Practical samples of ASP.NET Core 2.1, 2.2, 3.1, 5.0, 6.0 and 7.0 projects you can use. Readme contains explanations on all projects.
|
|
OrchardCMS/OrchardCore
Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
|