# WithPreAuthorizedApplication

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

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
func (EntraIdApplicationResource) 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()`.

## Applies to

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