Skip to content

Entra authentication emulation possible? #180

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

Open
seesharprun opened this issue Mar 10, 2025 · 0 comments
Open

Entra authentication emulation possible? #180

seesharprun opened this issue Mar 10, 2025 · 0 comments

Comments

@seesharprun
Copy link

seesharprun commented Mar 10, 2025

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

Today, I must use the CosmosClient constructor that takes ROPC instead of the Entra-specific ComsosClient constructor. Most of my applications use Entra authentication by default per Microsoft's published best practices. Unfortunately, this means that I need to create a second permutation of my client initialization logic for testing and development scenarios (ex: devcontainers).

This leads to messy code like:

if (builder.Environment.IsDevelopment())
{
    builder.Services.AddSingleton((_) => new CosmosClient(
        "https://localhost:8081",
        "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
    ));
}
else
{
    builder.Services.AddSingleton((provider) => new CosmosClient(
        provider.GetRequiredService<IOptions<Configuration>>().Value.Endpoint,
        new DefaultAzureCredential()
    ));
}

Describe the solution you'd like

An opt-in way to say "accept Entra authentication but don't actually verify it." It could be some flag on the emulator that allows you to connect with literally any Entra token.

So, I should be able to connect to the emulator using the same client logic (new CosmosClient("<endpoint>", new DefaultAzureCredential())) in both my production application and any integration or development test suite. This is assuming that I'm reading my endpoint from a configuration source.

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

No branches or pull requests

1 participant