# EntraIdApplicationResource.WithFederatedManagedIdentityCredential

- Module: [Aspire.Hosting.Azure.EntraId](/reference/api/go/aspire.hosting.azure.entraid.md)
- Defined on: [EntraIdApplicationResource](/reference/api/go/aspire.hosting.azure.entraid/entraidapplicationresource.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`

Configures a pre-existing managed identity trust for token acquisition, without provisioning or assigning an identity.

## Remarks

Applies in run and publish modes. This only emits consumer configuration; it does not create federation trust.

## Definition

```go
type EntraIdApplicationResource interface {
    // ... omitted for brevity
    WithFederatedManagedIdentityCredential(
        managedIdentityClientId string,
        options ...*EntraIdTokenExchangeOptions,
    ) EntraIdApplicationResource
}
```

## Signature

```go
WithFederatedManagedIdentityCredential(
    managedIdentityClientId string,
    options ...*EntraIdTokenExchangeOptions,
) EntraIdApplicationResource
```

## Parameters

- `managedIdentityClientId` (`string`) -- The client GUID of a user-assigned managed identity that the registration already trusts.
- `options` (`...*EntraIdTokenExchangeOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed as the existing [`*EntraIdTokenExchangeOptions`](/reference/api/go/aspire.hosting.azure.entraid/entraidtokenexchangeoptions.md) struct.

## Returns

[`EntraIdApplicationResource`](/reference/api/go/aspire.hosting.azure.entraid/entraidapplicationresource.md) -- The registration builder.

Returns a handle; failures surface later via `Err()`.

## Defined on

- [EntraIdApplicationResource](/reference/api/go/aspire.hosting.azure.entraid/entraidapplicationresource.md) -- `handle`
