# PublishWithAppRoleAssignment

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

Publishes explicit application-role assignments to a managed identity or a compute resource's managed identity.

## Remarks

Has no effect during local run. Existing registrations are not modified. No caller registration or federation is created.
Requires Graph AppRoleAssignment.ReadWrite.All and Application.Read.All (or higher application-read permission), administrator
consent and, for delegated deployment, a supported Entra directory role. Removing a call does not revoke a deployed grant.

## Definition

```go
func (EntraIdApplicationResource) PublishWithAppRoleAssignment(
    identity any,
    roleValues []string,
) EntraIdApplicationResource
```

## Parameters

- `identity` (`any`) -- The user-assigned identity or compute resource receiving the roles.
- `roleValues` (`[]string`) -- Enabled role values declared on this API that allow Application members.

## Returns

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

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

## Applies to

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