Microsoft.Azure.StackExchangeRedis
1.1.0
Prefix Reserved
See the version list below for details.
dotnet add package Microsoft.Azure.StackExchangeRedis --version 1.1.0
NuGet\Install-Package Microsoft.Azure.StackExchangeRedis -Version 1.1.0
<PackageReference Include="Microsoft.Azure.StackExchangeRedis" Version="1.1.0" />
paket add Microsoft.Azure.StackExchangeRedis --version 1.1.0
#r "nuget: Microsoft.Azure.StackExchangeRedis, 1.1.0"
// Install Microsoft.Azure.StackExchangeRedis as a Cake Addin
#addin nuget:?package=Microsoft.Azure.StackExchangeRedis&version=1.1.0
// Install Microsoft.Azure.StackExchangeRedis as a Cake Tool
#tool nuget:?package=Microsoft.Azure.StackExchangeRedis&version=1.1.0
ArtifactType: nupkg Documentation: https://learn.microsoft.com/azure/azure-cache-for-redis Language: C# Tags: Redis,Cache,StackExchange.Redis,Microsoft,Azure
Microsoft.Azure.StackExchangeRedis Extension
Microsoft.Azure.StackExchangeRedis is an extension of StackExchange.Redis that enables using Azure Active Directory to authenticate connections from a Redis client application to an Azure Cache for Redis. The extension manages the authentication token, including proactively refreshing tokens before they expire to maintain persistent Redis connections over multiple days.
Usage
Add a reference to the Microsoft.Azure.StackExchangeRedis NuGet package in your Redis client project
In your Redis connection code, create a
ConfigurationOptions
instance
var configurationOptions = await ConfigurationOptions.Parse($"{cacheHostName}:6380");
- Use one of the extension's methods to configure it for Azure:
// With a system-assigned managed identity
await configurationOptions.ConfigureForAzureWithSystemAssignedManagedIdentityAsync(principalId);
// With a user-assigned managed identity
await configurationOptions.ConfigureForAzureWithUserAssignedManagedIdentityAsync(managedIdentityClientId, principalId);
// With a service principal
await configurationOptions.ConfigureForAzureWithServicePrincipalAsync(clientId, principalId, tenantId, secret);
- Create the a connection by creating and passing in the ConfigurationOptions to the ConnectionMultiplexer.ConenctAsync
var connectionMultiplexer = await ConnectionMultiplexer.ConnectAsync(configurationOptions);
Running the sample
The sample
directory contains a project showing how to connect to a Redis cache using the various authentication mechanisms supported by this extension. To run the sample:
- Create an Azure Cache for Redis resource
- Create a managed identity or service principal
dotnet run <path to Microsoft.Azure.StackExchangeRedis.Sample.csproj>
- Follow the prompts to enter your credentials and test the connection to the cache
NOTE: The sample project uses a <ProjectReference>
to the extension project in this repo. To run the project on its own using the released Microsoft.Azure.StackExchangeRedis NuGet package, replace the <ProjectReference>
in Microsoft.Azure.StackExchangeRedis.Sample.csproj
with a <PackageReference>
.
Contributing
Please read our CONTRIBUTING.md which outlines all of our policies, procedures, and requirements for contributing to this project.
Versioning
We use SemVer for versioning. For the versions available, see the releases.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Identity.Client (>= 4.53.0)
- StackExchange.Redis (>= 2.6.111)
-
net6.0
- Microsoft.Identity.Client (>= 4.53.0)
- StackExchange.Redis (>= 2.6.111)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Microsoft.Azure.StackExchangeRedis:
Package | Downloads |
---|---|
Microsoft.Azure.WebJobs.Extensions.Redis
This package contains binding extensions for Redis. |
|
IglooSoftware.Sdk.Caching
Igloo SDK for sharing commonly used methods. |
|
EndpointDefender
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.