# WithOwners

- Module: [Aspire.Hosting.Azure.EntraId](/reference/api/go/aspire.hosting.azure.entraid.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`
- Defined on: [`EntraIdApplicationResource`](/reference/api/go/aspire.hosting.azure.entraid/entraidapplicationresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Appends an owner to both the application registration and service principal.

## Remarks

Owners can manage the registration. Call repeatedly for multiple owners. Throws for existing registrations; configure their owners manually.

## Definition

```go
func (EntraIdApplicationResource) WithOwners(ownerObjectId any) EntraIdApplicationResource
```

## Parameters

- `ownerObjectId` (`any`) -- The directory object GUID of a user or service principal, as a literal or parameter.

## Returns

[`EntraIdApplicationResource`](/reference/api/go/aspire.hosting.azure.entraid/entraidapplicationresource.md) -- The registration builder.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`EntraIdApplicationResource`](/reference/api/go/aspire.hosting.azure.entraid/entraidapplicationresource.md)
