# MicrosoftGraphServicePrincipal

- 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/MicrosoftGraphServicePrincipal.cs)
- Inherits: `ProvisionableResource`

Models the service principal created for an Entra application registration.

## Definition

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

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

## Remarks

See [https://learn.microsoft.com/graph/templates/bicep/reference/serviceprincipals](https://learn.microsoft.com/graph/templates/bicep/reference/serviceprincipals).

## Constructors

- [MicrosoftGraphServicePrincipal(string)](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphserviceprincipal/constructors.md#constructor-string) -- Models the service principal created for an Entra application registration.

## Properties

- [AccountEnabled](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphserviceprincipal/properties.md#accountenabled) : `BicepValue<bool>` `get; set` -- Gets or sets whether the service principal is enabled. When `false`, no user can sign in to the application.
- [AppId](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphserviceprincipal/properties.md#appid) : `BicepValue<string>` `get; set` -- Gets or sets the associated application's client ID.
- [AppRoleAssignmentRequired](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphserviceprincipal/properties.md#approleassignmentrequired) : `BicepValue<bool>` `get; set` -- Gets or sets whether users or other service principals need an app role assignment before they can sign in or get tokens.
- [Description](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphserviceprincipal/properties.md#description) : `BicepValue<string>` `get; set` -- Gets or sets a description of the service principal, shown to end users in portals such as My Apps.
- [Id](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphserviceprincipal/properties.md#id) : `BicepValue<string>` `get` -- Gets the service principal's directory object ID.
- [Notes](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphserviceprincipal/properties.md#notes) : `BicepValue<string>` `get; set` -- Gets or sets notes for managing the service principal.
- [NotificationEmailAddresses](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphserviceprincipal/properties.md#notificationemailaddresses) : `BicepList<string>` `get; set` -- Gets or sets the email addresses that receive notifications, such as certificate expiry.
- [Owners](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphserviceprincipal/properties.md#owners) : `BicepList<string>` `get; set` -- Gets or sets the directory object IDs of the service principal's owners.
- [Tags](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphserviceprincipal/properties.md#tags) : `BicepList<string>` `get; set` -- Gets or sets the custom strings used to categorize the service principal.

## Methods

- [FromExisting(string)](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphserviceprincipal/methods.md#fromexisting-string) : [MicrosoftGraphExistingServicePrincipal](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphexistingserviceprincipal.md) `static` -- Creates a reference to a service principal that already exists in the tenant, such as the one for Microsoft Graph, addressed by its application (client) ID.
