---
title: "Orleans.Lattice.Explorer.Entra configuration"
url: "https://nsta1.github.io/Orleans.Lattice/docs/lattice.explorer.entra/configuration.html"
source: "https://github.com/NSTA1/Orleans.Lattice/blob/release/10.5/docs/lattice.explorer.entra/configuration.md"
agent_spec: "https://nsta1.github.io/Orleans.Lattice/docs/agents/governance/identity-propagation.json"
package: "Orleans.Lattice.Explorer.Entra"
version: "10.5.0"
documents: "Orleans.Lattice 10.5.0 (release line 10.5)"
built: "2026-12-05"
all-pages: "https://nsta1.github.io/Orleans.Lattice/llms.txt"
bundle: "https://nsta1.github.io/Orleans.Lattice/docs/lattice.explorer.entra/llms-full.txt"
---
# Orleans.Lattice.Explorer.Entra configuration

Part of the [Explorer.Entra documentation](README.md).

Configure `ExplorerEntraOptions` with
`AddExplorerEntraAuth(configure)`. These values are public OIDC parameters;
the package has no client-secret option. Configured values take precedence over
a State API auth-scheme advertisement; the advertisement fills only unset
values.

| Property | Type | Default | Meaning |
|---|---|---|---|
| `Authority` | `string?` | `null` | OIDC authority. Takes precedence over `TenantId`; when neither is set, an admitted advertised authority may supply it, or else an advertised tenant id composes `https://login.microsoftonline.com/{tenant}`. |
| `TenantId` | `string?` | `null` | Directory tenant id used to compose `https://login.microsoftonline.com/{tenant}` when `Authority` is unset. |
| `ClientId` | `string?` | `null` | Public client application id. An advertised client id is used only when this is unset. |
| `Scopes` | `IList<string>` | Empty | Requested State API scopes. If empty, the method resolves an admitted advertised audience and adds `/.default` unless already present. |
| `AllowedAuthorityHosts` | `IList<string>` | Empty | Replaces the built-in Entra login-host set for advertised authorities. Configured `Authority` or `TenantId` does not use this list. |
| `AllowedAudiences` | `IList<string>` | Empty | Replaces the default admission rule for an advertised audience when `Scopes` is empty. The default accepts `api://` resources and HTTPS resources on the State API endpoint host. |
| `UseDeviceCode` | `bool` | `false` | Uses device-code flow for initial token acquisition instead of the interactive browser flow. |
| `DeviceCodeCallback` | `Func<string, CancellationToken, Task>?` | `null` | Receives the device-code prompt. The default acquirer writes it to standard output when no callback is supplied. |

`AddExplorerEntraAuth` registers the acquirer and auth method as scoped services.
Options are not required at registration time: when authority, client id or
scope is absent, the method can use endpoint-advertised values. A challenge
fails with `InvalidOperationException` if it still cannot resolve an authority,
client id or at least one scope.

## Authority and audience admission

An endpoint advertisement is a hint, not trusted configuration. When it supplies
the authority, that value must be an absolute HTTPS URL whose host is admitted.
The default authority-host set is `login.microsoftonline.com`,
`login.microsoftonline.us`, `login.partner.microsoftonline.cn` and
`login.microsoftonline.de`. A non-empty `AllowedAuthorityHosts` list replaces
that set. When the endpoint advertises no authority but does advertise a tenant
id, the method composes `https://login.microsoftonline.com/{tenant}` from it, so
the host is fixed rather than endpoint-chosen.

When scopes are empty, the advertised audience is accepted by default only when
it is an `api://` resource or an HTTPS resource sharing the configured State API
endpoint's host. A non-empty `AllowedAudiences` list replaces that rule with
case-insensitive exact matches. If the audience already ends in `/.default`, it
is used as the scope; otherwise that suffix is appended. A refused authority or
audience fails the challenge with `InvalidOperationException` rather than being
used.

## Example

```csharp verify
using Microsoft.Extensions.DependencyInjection;
using Orleans.Lattice.Explorer.Core.Authentication;
using Orleans.Lattice.Explorer.Entra;

var services = new ServiceCollection();
services.AddExplorerAuth();
services.AddExplorerEntraAuth(options =>
{
    options.Authority = "https://login.microsoftonline.com/tenant-id";
    options.ClientId = "public-client-id";
    options.Scopes.Add("api://state-api/.default");
});
```

## See also

- [API reference](api.md)
- [Architecture](architecture.md)
- [Connecting to an auth-enabled State API](../lattice.explorer/connecting-to-an-auth-enabled-state-api.md)
