Skip to content

Conversation

@pharring
Copy link
Contributor

Why make this change?

So you can use an Azure Managed Redis or Azure Cache for Redis instance with Entra authentication as a level 2 cache.

What is this change?

If the Redis connection string does not include a password and you are NOT connecting to localhost, then we assume you are connecting to an instance that requires Entra authentication. In that case, we use the DefaultAzureCredential (managed identity) to connect.

How was this tested?

Tested manually and ran unit tests.

Sample Request(s)

N/A

@JerryNixon JerryNixon marked this pull request as ready for review January 21, 2026 21:47
Copilot AI review requested due to automatic review settings January 21, 2026 21:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for Azure Entra authentication when connecting to Azure Managed Redis or Azure Cache for Redis instances. The implementation automatically detects when Entra authentication should be used based on whether a password is present in the connection string and whether the endpoint is localhost.

Changes:

  • Added new CreateConnectionMultiplexerAsync method that handles both traditional password-based and Entra-based Redis authentication
  • Added Microsoft.Azure.StackExchangeRedis package to enable Azure-specific Redis features
  • Updated Azure.Identity and Microsoft.Extensions.Configuration.Binder package versions

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/Service/Startup.cs Added CreateConnectionMultiplexerAsync method with Entra authentication support and localhost detection logic
src/Service/Azure.DataApiBuilder.Service.csproj Added Microsoft.Azure.StackExchangeRedis package reference
src/Directory.Packages.props Updated Azure.Identity to 1.17.1, Microsoft.Extensions.Configuration.Binder to 8.0.2, and added Microsoft.Azure.StackExchangeRedis 3.3.1

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Aniruddh25
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@Aniruddh25
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

Copy link
Contributor

@souvikghosh04 souvikghosh04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some review comments. also, it would be good to mention how this was tested as I don't see any supporting tests for the change. having test coverage with different scenarios would be great.

@Aniruddh25
Copy link
Collaborator

/azp run

Copy link
Collaborator

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for these contributions :)

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@Aniruddh25 Aniruddh25 enabled auto-merge (squash) February 5, 2026 21:15
@Aniruddh25
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@pharring
Copy link
Contributor Author

pharring commented Feb 6, 2026

I'm investigating the unit test failure(s). The response message says the audience is "null" instead of BAD_AUDIENCE. Possibly caused by the Azure.Identity version bump (perhaps the latest MSAL obscures the audience name).

auto-merge was automatically disabled February 6, 2026 01:41

Head branch was pushed to by a user without write access

@souvikghosh04
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@Aniruddh25
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@Aniruddh25 Aniruddh25 enabled auto-merge (squash) February 10, 2026 22:47
@Aniruddh25
Copy link
Collaborator

Aniruddh25 commented Feb 10, 2026

@copilot: can you fix the following formatting issues:

/home/vsts/work/1/s/src/Service/Startup.cs(155,151): error WHITESPACE: Fix whitespace formatting. Replace 25 characters with '\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]
/home/vsts/work/1/s/src/Service/Startup.cs(156,73): error WHITESPACE: Fix whitespace formatting. Replace 25 characters with '\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]
/home/vsts/work/1/s/src/Service/Startup.cs(157,118): error WHITESPACE: Fix whitespace formatting. Replace 25 characters with '\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]
/home/vsts/work/1/s/src/Service/Startup.cs(158,60): error WHITESPACE: Fix whitespace formatting. Replace 25 characters with '\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]
/home/vsts/work/1/s/src/Service/Startup.cs(170,56): error WHITESPACE: Fix whitespace formatting. Replace 25 characters with '\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]
/home/vsts/work/1/s/src/Service/Startup.cs(171,72): error WHITESPACE: Fix whitespace formatting. Replace 25 characters with '\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]
/home/vsts/work/1/s/src/Service/Startup.cs(172,118): error WHITESPACE: Fix whitespace formatting. Replace 25 characters with '\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]
/home/vsts/work/1/s/src/Service/Startup.cs(173,60): error WHITESPACE: Fix whitespace formatting. Replace 25 characters with '\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]
/home/vsts/work/1/s/src/Service/Startup.cs(517,1): error WHITESPACE: Fix whitespace formatting. Replace 15 characters with '\n\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]
/home/vsts/work/1/s/src/Service/Startup.cs(523,1): error WHITESPACE: Fix whitespace formatting. Replace 8 characters with '\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]
/home/vsts/work/1/s/src/Service/Startup.cs(635,19): error WHITESPACE: Fix whitespace formatting. Replace 17 characters with '\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]
/home/vsts/work/1/s/src/Service/Startup.cs(636,83): error WHITESPACE: Fix whitespace formatting. Replace 17 characters with '\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]
/home/vsts/work/1/s/src/Service/Startup.cs(637,82): error WHITESPACE: Fix whitespace formatting. Replace 17 characters with '\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]
/home/vsts/work/1/s/src/Service/Startup.cs(638,90): error WHITESPACE: Fix whitespace formatting. Replace 17 characters with '\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s'. [/home/vsts/work/1/s/src/Service/Azure.DataApiBuilder.Service.csproj]

@Aniruddh25
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@souvikghosh04 souvikghosh04 self-requested a review February 11, 2026 04:15
@Aniruddh25 Aniruddh25 merged commit b3efb1a into Azure:main Feb 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants