AspNetCore.Identity.Stores.AzureStorageAccount
2.0.0
See the version list below for details.
dotnet add package AspNetCore.Identity.Stores.AzureStorageAccount --version 2.0.0
NuGet\Install-Package AspNetCore.Identity.Stores.AzureStorageAccount -Version 2.0.0
<PackageReference Include="AspNetCore.Identity.Stores.AzureStorageAccount" Version="2.0.0" />
paket add AspNetCore.Identity.Stores.AzureStorageAccount --version 2.0.0
#r "nuget: AspNetCore.Identity.Stores.AzureStorageAccount, 2.0.0"
// Install AspNetCore.Identity.Stores.AzureStorageAccount as a Cake Addin #addin nuget:?package=AspNetCore.Identity.Stores.AzureStorageAccount&version=2.0.0 // Install AspNetCore.Identity.Stores.AzureStorageAccount as a Cake Tool #tool nuget:?package=AspNetCore.Identity.Stores.AzureStorageAccount&version=2.0.0
Azure Storage Account
This is how to use Azure storage account as storage for ASP.NET identity.
Create a new ASP.NET Core Web App
From Additional information dialog select authentication type Individual Accounts
Install AspNetCore.Identity.Stores.AzureStorageAccount package from NuGet manager.
<code>Install-Package AspNetCore.Identity.Stores.AzureStorageAccount</code>
In Program.cs replace DbContext and Identity initialization with the folowing code
using AspNetCore.Identity.Stores; using AspNetCore.Identity.Stores.AzureStorageAccount.Extensions;
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection"); //Configure identity repository connection builder.Services.Configure<IdentityStoresOptions>(options => options .UseAzureStorageAccount(connectionString)); builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true) .AddRoles<IdentityRole>() .AddAzureStorageAccountStores(); //Add Identity stores
In appsettings.json update DefaultConnection with Azure Storage Account connection string
NOTE: For local development you may use "UseDevelopmentStorage=true" as connection string to connect to Azure storage emulator.
Configuration
As shown in the code snippet from point 4, IdentityStoresOptions has an extension method UseAzureStorageAccount to configure the connection and it has 2 parameters:
- connectionString: To specify the connection string of CosmosDB instance.
- tableName (optinal): To specify the table which will be used, the default value is AspNetIdentity
Note: If the specified table not exists, it will get created on startup.
See more:
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- AspNetCore.Identity.Stores (>= 2.0.0)
- Azure.Data.Tables (>= 12.6.1)
- Microsoft.AspNetCore.DataProtection.Abstractions (>= 6.0.8)
- Microsoft.Extensions.Identity.Stores (>= 6.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.