# MicrosoftGraphExistingServicePrincipal

- 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`

References a service principal that already exists in the tenant, addressed by its application (client) ID.

## Definition

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

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

## Remarks

Azure.Provisioning leaves only the property named `Name` settable on an existing resource, and it uses that property to address the resource, so the application ID is exposed as [MicrosoftGraphExistingServicePrincipal.Name](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphexistingserviceprincipal/properties.md#name).

## Constructors

- [MicrosoftGraphExistingServicePrincipal(string)](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphexistingserviceprincipal/constructors.md#constructor-string) -- Creates a reference to an existing service principal.

## Properties

- [Id](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphexistingserviceprincipal/properties.md#id) : `BicepValue<string>` `get` -- Gets the service principal's directory object ID.
- [Name](/reference/api/csharp/aspire.hosting.azure.entraid/microsoftgraphexistingserviceprincipal/properties.md#name) : `BicepValue<string>` `get; set` -- Gets or sets the application (client) ID that addresses the service principal.
