# withEntraIdReference

- Module: [Aspire.Hosting.Azure.EntraId](/reference/api/typescript/aspire.hosting.azure.entraid.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Injects Entra ID authentication configuration into a consuming resource and sets the prefix of its DownstreamApis entries.

## Definition

```typescript
interface ContainerResource {
  // ... omitted for brevity
  withEntraIdReference(
    source: EntraIdApplicationResource,
    connectionName?: string,
    downstreamApisPrefix?: string): IResourceWithEnvironment
}
```

## Parameters

- `source` ([EntraIdApplicationResource](/reference/api/typescript/aspire.hosting.azure.entraid/entraidapplicationresource.md))
- `connectionName` (`string`) `optional`
- `downstreamApisPrefix` (`string`) `optional`

## Returns

`IResourceWithEnvironment` `builder`

## Applies to

- [ContainerResource](/reference/api/typescript/aspire.hosting.azure.entraid/containerresource.md)
- [ExecutableResource](/reference/api/typescript/aspire.hosting.azure.entraid/executableresource.md)
- [ProjectResource](/reference/api/typescript/aspire.hosting.azure.entraid/projectresource.md)
- [DotnetToolResource](/reference/api/typescript/aspire.hosting.azure.entraid/dotnettoolresource.md)
- [CSharpAppResource](/reference/api/typescript/aspire.hosting.azure.entraid/csharpappresource.md)
