Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

WithAppRole

Method
📦 Aspire.Hosting.Azure.EntraId v17.0.0-preview.1.26565.2
func (EntraIdApplicationResource) WithAppRole(
value string,
displayName string,
description string,
options ...*WithAppRoleOptions,
) EntraIdApplicationResource

Signature

methodWithAppRolebuilder
Declares an application role on a registration created by Aspire.
WithAppRole(
value string,
displayName string,
description string,
options ...*WithAppRoleOptions,
) EntraIdApplicationResource
valuestringThe value emitted in the roles claim, for example Admin. It must be unique for the application, at most 120 characters, must not start with a period, and may contain only ASCII letters, digits and the punctuation that Microsoft Graph allows.
displayNamestringThe display name shown in the Microsoft Entra admin center.
descriptionstringThe description shown in assignment and consent experiences.
options...*WithAppRoleOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithAppRoleOptions argument.

AllowedMemberTypes[]stringThe member types the role can be assigned to, passed through to Microsoft Graph (for example User or Application). Defaults to User.
Id*stringAn optional role GUID. When omitted, a stable ID is derived from the registration's resource name and value.
IsEnabled*boolWhether the role is enabled. Defaults to true. To retire a role, deploy it with false and leave it declared; disabling is not access revocation because existing assignments still receive the role in tokens.
EntraIdApplicationResource

The registration builder.

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

Applies to

This method applies to the following types: