Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any plans for Managed Identity authentication for Microsoft.Extensions.Caching.StackExchangeRedis? #54414

Closed
1 task done
arealmaas opened this issue Mar 7, 2024 · 6 comments
Labels
area-identity Includes: Identity and providers External This is an issue in a component not contained in this repository. It is open for tracking purposes.

Comments

@arealmaas
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I am using IDistributedCache, and I want to use Redis as backing. Using the following library and guide it seems like we need to pass a connection string. We want to be able to use Managed Identity towards all our Azure services.

https://learn.microsoft.com/en-us/aspnet/core/performance/caching/distributed?view=aspnetcore-8.0#distributed-redis-cache

Describe the solution you'd like

Being able to authenticate to Redis using Managed Identity like we can for this package: https://github.com/Azure/Microsoft.Azure.StackExchangeRedis. Are there any plans on implementing Managed Identity for this?

Additional context

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-identity Includes: Identity and providers label Mar 7, 2024
arealmaas added a commit to digdir/dialogporten that referenced this issue Mar 11, 2024
…edis (#526)

It seems like we need to use a connection string to connect to the Redis
library used by IDistributedCache. Until we can use managed identity,
that is the case. dotnet/aspnetcore#54414
@mkArtakMSFT mkArtakMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2024
@mkArtakMSFT mkArtakMSFT added the External This is an issue in a component not contained in this repository. It is open for tracking purposes. label Mar 11, 2024
@mkArtakMSFT mkArtakMSFT reopened this Mar 11, 2024
@mkArtakMSFT
Copy link
Member

Thanks for contacting us. This doesn't seem to be something worth implementing in the framework layer.

@mkArtakMSFT mkArtakMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2024
@halter73
Copy link
Member

You could ask for https://github.com/Azure/Microsoft.Azure.StackExchangeRedis to implement IDistributedCache, or you could take the IConnectionMultiplexer you get from managed identity authentication with Microsoft.Azure.StackExchangeRedis, and return it from a custom ConnectionMultiplexerFactory.

@arealmaas
Copy link
Author

Thanks for the suggestion @halter73 . I'll test it out

@A-Stapleton
Copy link

This would be nice to get support for MI in this. It's a big gap in dev experience from a using Microsoft products all up perspective.

They said they won't do IDistributedCache Azure/Microsoft.Azure.StackExchangeRedis#12 (comment)

@RichFinn-WTW
Copy link

RichFinn-WTW commented Aug 6, 2024

This would be nice to get support for MI in this. It's a big gap in dev experience from a using Microsoft products all up perspective.

They said they won't do IDistributedCache Azure/Microsoft.Azure.StackExchangeRedis#12 (comment)

@arealmaas @A-Stapleton - we were able to get Microsoft.Azure.StackExchangeRedis working with Microsoft.Extensions.Caching.StackExchangeRedis and MI

check out this comment: Azure/Microsoft.Azure.StackExchangeRedis#12 (comment)

@bhargav-kansagara
Copy link

Sample on how to use MSI with IDistributedCache, just add the following in startup:

services.AddStackExchangeRedisCache(options` =>
{
    options.ConfigurationOptions = new ConfigurationOptions
        {
            EndPoints = { "endpoint" },
        };

    options.ConnectionMultiplexerFactory = async () =>
    {
        await options.ConfigurationOptions.ConfigureForAzureWithTokenCredentialAsync(new DefaultAzureCredential()).ConfigureAwait(false);
        return await ConnectionMultiplexer.ConnectAsync(options.ConfigurationOptions).ConfigureAwait(false);
    };
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-identity Includes: Identity and providers External This is an issue in a component not contained in this repository. It is open for tracking purposes.
Projects
None yet
Development

No branches or pull requests

6 participants