feat: support azure entraid for managed redis - #776
Merged
Conversation
Contributor
📄 Knowledge review✏️ Documentation updates1 page was updated by changes in this PR.
📝 cache — changes@@ -105,11 +105,38 @@
```go
cache.InitRedisClient(
addr, // "localhost:6379"
- username, // optional
- password,
+ cache.RedisCredentials{
+ Username: username, // optional
+ Password: password,
+ },
useSsl, // bool
db, // database number
+ tlsConf, // *tls.Config, can be nil
)
+```
+
+### Azure Entra ID Authentication
+
+The daemon supports Azure Managed Identity (Entra ID) for Redis authentication.
+This is configured using the `REDIS_USE_AZURE_MANAGED_IDENTITY` environment variable.
+When enabled, static `REDIS_PASSWORD`/`REDIS_USERNAME` are ignored and a streaming
+token provider is used instead. Azure Managed Redis requires `REDIS_DB=0` (the system
+validates this at startup).
+
+```go
+creds := cache.RedisCredentials{
+ Username: username,
+ Password: password,
+}
+if useAzureManagedIdentity {
+ provider, err := cache.NewAzureEntraIDCredentialsProvider()
+ if err != nil {
+ // handle error
+ }
+ creds.CredentialProvider = provider
+}
+
+cache.InitRedisClient(addr, creds, useSsl, db, tlsConf)
```
Redis naming behavior: |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for authenticating to Azure Cache for Redis using Entra ID (Managed Identity) by introducing streaming credential support in the Redis client initialization path, and wiring it through configuration and startup.
Changes:
- Introduces
RedisCredentialsand passes aStreamingCredentialsProviderinto go-redis options/failover options to enable token-based auth. - Adds an Azure Entra ID credentials provider factory and a new env/config flag (
REDIS_USE_AZURE_MANAGED_IDENTITY) with validation (DB must be 0). - Updates all Redis-related tests and call sites to use the new
InitRedisClient/InitRedisSentinelClientsignatures.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/utils/cache/redis.go | Adds RedisCredentials and wires streaming credentials into redis options. |
| pkg/utils/cache/azure_credentials.go | Implements Azure Entra ID (Managed Identity) streaming credentials provider creation. |
| internal/types/app/config.go | Adds config flag and validates Redis DB constraints for Azure managed identity. |
| internal/core/plugin_manager/manager.go | Builds Redis credentials and initializes Redis client/sentinel with new credentials API. |
| pkg/utils/cache/redis_test.go | Updates tests to use RedisCredentials with the new init signature. |
| pkg/utils/cache/redis_auto_type_test.go | Updates tests to use RedisCredentials with the new init signature. |
| internal/types/models/curd/testmain_test.go | Updates Redis init in test main to use RedisCredentials. |
| internal/service/plugin_decoder_test.go | Updates Redis init in test setup to use RedisCredentials. |
| internal/service/debugging_service/connection_key_test.go | Updates Redis init to use RedisCredentials. |
| internal/core/session_manager/session_trace_test.go | Updates Redis init to use RedisCredentials. |
| internal/core/persistence/persistence_test.go | Updates Redis init to use RedisCredentials. |
| internal/core/debugging_runtime/server_test.go | Updates Redis init to use RedisCredentials (plus minor whitespace cleanup). |
| internal/cluster/clutser_test.go | Updates Redis init to use RedisCredentials. |
| go.mod | Adds github.com/redis/go-redis-entraid and bumps Azure identity dependency. |
| go.sum | Adds checksums for new/bumped dependencies. |
| .env.example | Documents the new Azure managed identity Redis auth flag and constraints. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
fatelei
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Support EntraID for azure managed Redis
resolves ESQ1-184
Type of Change
Essential Checklist
Testing
Bug Fix (if applicable)
Fixes #123orCloses #123)Additional Information
Please provide any additional context that would help reviewers understand the changes.