# EntraIdApplicationResource.WithExternalApiPermissions

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

Declares permissions to a Microsoft first-party or other API that is not an Aspire resource, such as Microsoft Graph.

## Remarks

For a registration created by Aspire, this adds the permissions to the registration's API permissions list. It grants nothing;
use withExternalApiAdminConsent to opt in to consent. For an existing registration, nothing is deployed: the declaration only
configures the DownstreamApis entries that resources referencing the registration receive.
Delegated permissions let the application act for a signed-in user. Application permissions let it act as itself and always need administrator consent.
The two kinds are separate permissions, even when they share a name. Well-known APIs resolve common permission names to their IDs;
other permissions, and every permission of a custom API, need an explicit id.

## Definition

```go
type EntraIdApplicationResource interface {
    // ... omitted for brevity
    WithExternalApiPermissions(
        api any,
        permissions []*EntraIdExternalApiPermission,
    ) EntraIdApplicationResource
}
```

## Signature

```go
WithExternalApiPermissions(
    api any,
    permissions []*EntraIdExternalApiPermission,
) EntraIdApplicationResource
```

## Parameters

- `api` (`any`) -- A well-known API, or an API identified by its application ID and application ID URI.
- `permissions` ([`[]*EntraIdExternalApiPermission`](/reference/api/go/aspire.hosting.azure.entraid/entraidexternalapipermission.md)) -- The permissions to declare. Each is delegated unless its type is Application.

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