# MicrosoftGraphOAuth2PermissionGrant

- 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.EntraId.Provisioning`
- Target framework: `net10.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.Azure.EntraId/Provisioning/MicrosoftGraphPermissionGrants.cs)
- Inherits: `ProvisionableResource`

Models a delegated permission grant ( `oauth2PermissionGrant`) that consents to scopes of an API on behalf of users.

## Definition

```csharp
namespace Aspire.Hosting.Azure.EntraId.Provisioning;

public sealed class MicrosoftGraphOAuth2PermissionGrant
    : Azure.Provisioning.Primitives.ProvisionableResource
{
    // ...
}
```

## Constructors

- [MicrosoftGraphOAuth2PermissionGrant(string)](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphoauth2permissiongrant/constructors.md#constructor-string) -- Models a delegated permission grant ( `oauth2PermissionGrant`) that consents to scopes of an API on behalf of users.

## Properties

- [ClientId](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphoauth2permissiongrant/properties.md#clientid) : `BicepValue<string>` `get; set` -- Gets or sets the object ID of the client's service principal.
- [ConsentType](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphoauth2permissiongrant/properties.md#consenttype) : `BicepValue<string>` `get; set` -- Gets or sets who consents: `AllPrincipals` grants the scopes tenant-wide.
- [Id](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphoauth2permissiongrant/properties.md#id) : `BicepValue<string>` `get` -- Gets the permission grant's directory object ID.
- [ResourceId](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphoauth2permissiongrant/properties.md#resourceid) : `BicepValue<string>` `get; set` -- Gets or sets the object ID of the API's service principal.
- [Scope](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphoauth2permissiongrant/properties.md#scope) : `BicepValue<string>` `get; set` -- Gets or sets the granted scope values, separated by a single space.
