# EntraIdApiPermission

- Kind: `class`
- Package: [Aspire.Hosting.Azure.EntraId](/reference/api/csharp/aspire.hosting.azure.entraid.md)
- Version: `17.0.0-preview.1.26567.5`
- Namespace: `Aspire.Hosting.Azure`
- Target framework: `net10.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.Azure.EntraId/EntraIdApi.cs)

A permission, identified by name and optionally by ID, that an application requests from an API.

## Definition

```csharp
namespace Aspire.Hosting.Azure;

public sealed class EntraIdApiPermission
{
    // ...
}
```

## Remarks

Delegated permissions are scopes that the API exposes and the application uses on behalf of a signed-in user. Application permissions are app roles that the API defines and the application uses as itself. They are different permissions, even when they share a name, and each needs its own consent. For a permission that isn't in an API's built-in list, Aspire can't check that the name and the ID belong together. The declaration uses the ID, while a delegated consent grant names the permission, so a name that doesn't match the ID would grant a permission that was never declared. Take both from the API's service principal.

## Properties

- [Id](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapipermission/properties.md#id) : `Guid?` `get` -- Gets the permission's ID, or `null` when it is resolved from the API's well-known permissions.
- [Name](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapipermission/properties.md#name) : `string` `get` -- Gets the permission's name, such as `User.Read`.
- [Type](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapipermission/properties.md#type) : [EntraIdPermissionType](/reference/api/csharp/aspire.hosting.azure.entraid/entraidpermissiontype.md) `get` -- Gets the kind of permission.

## Methods

- [Application(string)](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapipermission/methods.md#application-string) : [EntraIdApiPermission](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapipermission.md) `static` -- Requests an application permission by name, using the ID that Aspire knows for the API.
- [Application(string, Guid)](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapipermission/methods.md#application-string-guid) : [EntraIdApiPermission](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapipermission.md) `static` -- Requests an application permission by name and ID.
- [Delegated(string)](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapipermission/methods.md#delegated-string) : [EntraIdApiPermission](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapipermission.md) `static` -- Requests a delegated permission by name, using the ID that Aspire knows for the API.
- [Delegated(string, Guid)](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapipermission/methods.md#delegated-string-guid) : [EntraIdApiPermission](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapipermission.md) `static` -- Requests a delegated permission by name and ID.
