# EntraIdAppRole Constructors

- Package: [Aspire.Hosting.Azure.EntraId](/reference/api/csharp/aspire.hosting.azure.entraid.md)
- Type: [EntraIdAppRole](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapprole.md)
- Kind: `Constructors`
- Members: `1`

Describes an application role declared on a Microsoft Entra ID application registration created by Aspire.

<a id="constructor"></a>
<a id="constructor-string-string-string-ienumerable-string-guid-bool"></a>

## EntraIdAppRole(string, string, string, IEnumerable<string>, Guid?, bool)

- Name: `Constructor(string, string, string, IEnumerable<string>, Guid?, bool)`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.Azure.EntraId/EntraIdAppRole.cs#L38-L66)

Initializes a new instance of the [EntraIdAppRole](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapprole.md) class.

```csharp
public sealed class EntraIdAppRole
{
    public EntraIdAppRole(
        string value,
        string displayName,
        string description,
        IEnumerable<string>? allowedMemberTypes = null,
        Guid? id = null,
        bool isEnabled = true)
    {
        // ...
    }
}
```

## Parameters

- `value` (`string`)
  The value emitted in the `roles` claim, for example `Admin`. It must be unique for the application, at most 120 characters, must not start with a period, and may contain only ASCII letters, digits and the punctuation that Microsoft Graph allows: `! # $ % & ' ( ) * + , - . / : ; < = > ? @ [ ] ^ _ { | } ~`.
- `displayName` (`string`)
  The display name shown in the Microsoft Entra admin center.
- `description` (`string`)
  The description shown in assignment and consent experiences.
- `allowedMemberTypes` (`IEnumerable<string>`) `optional`
  The member types the role can be assigned to, passed through to Microsoft Graph (for example `User` or `Application`). Defaults to `User`.
- `id` (`Guid?`) `optional`
  An optional role ID. When omitted, a stable ID is derived from the application's resource name and `value`.
- `isEnabled` (`bool`) `optional`
  Whether the role is enabled. To retire a role, deploy it with `false` and leave it declared. A disabled role can't be assigned to anyone new, but Microsoft Entra keeps issuing it in tokens for existing assignments, so disabling is not access revocation; remove existing assignments separately. Microsoft Graph rejects deleting an enabled role, so delete one only after a deployment has disabled it, and only while other roles remain declared.

## Exceptions

- `ArgumentException` -- Thrown when an argument is invalid.
