# EntraIdApplicationResource.WithScope

- 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.26565.2`
- Kind: `method`

Exposes a delegated permission scope that clients can request to call this registration as an API.

## Remarks

Scopes are declared explicitly. Unless an application ID URI is set with withApplicationIdUri, the registration uses api://{clientId}.
The scope's ID stays the same across deployments. Microsoft Graph does not let a deployment remove an enabled scope or change its name:
to retire a scope, deploy it with isEnabled set to false and remove it in a later deployment.
For an existing registration the scope is configuration only, which lets callers declare permissions to it. Set its id to the ID the registration defines.

## Definition

```go
type EntraIdApplicationResource interface {
    // ... omitted for brevity
    WithScope(
        name string,
        description string,
        options ...*EntraIdScopeOptions,
    ) EntraIdApplicationResource
}
```

## Signature

```go
WithScope(
    name string,
    description string,
    options ...*EntraIdScopeOptions,
) EntraIdApplicationResource
```

## Parameters

- `name` (`string`) -- The scope's name, which appears in the token's scp claim, such as access_as_user.
- `description` (`string`) -- What the scope allows, shown on the consent page.
- `options` (`...*EntraIdScopeOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed as the existing [`*EntraIdScopeOptions`](/reference/api/go/aspire.hosting.azure.entraid/entraidscopeoptions.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`
