# EntraIdApplicationResource.WithPreAuthorizedApplication

- 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`

Pre-authorizes a client application to request some of this registration's scopes without any consent prompt.

## Remarks

Pre-authorization is separate from the client's declaration of the permission (`WithApiPermissions`)
and from consent (`WithAdminConsent`).
It lets a trusted client skip the consent prompt, which is intended for first-party clients of the same organization.
Aspire deploys each registration as its own module. Pre-authorization makes this registration wait for the client's ID, while
the client's declaration waits for this registration's ID, so two registrations cannot use both. Use a declaration with
`WithAdminConsent` on the client, or pre-authorization alone. Throws if this API registration is existing;
configure its pre-authorized clients manually. An existing client can still be pre-authorized by a registration Aspire creates.

## Definition

```go
type EntraIdApplicationResource interface {
    // ... omitted for brevity
    WithPreAuthorizedApplication(
        client EntraIdApplicationResource,
        scopeNames []string,
    ) EntraIdApplicationResource
}
```

## Signature

```go
WithPreAuthorizedApplication(
    client EntraIdApplicationResource,
    scopeNames []string,
) EntraIdApplicationResource
```

## Parameters

- `client` ([`EntraIdApplicationResource`](/reference/api/go/aspire.hosting.azure.entraid/entraidapplicationresource.md)) -- The client application to pre-authorize.
- `scopeNames` (`[]string`) -- The names of the scopes, added with `WithScope`, that the client may request.

## Returns

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

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

## Defined on

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