Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

EntraIdApplicationResource

Handle
📦 Aspire.Hosting.Azure.EntraId v17.0.0-preview.1.26565.2

A resource that represents a Microsoft Entra ID application registration.

type EntraIdApplicationResource interface {
Resource
}

Methods

References an existing registration without undoing the Azure provisioning setup enabled when this resource was added.
AsExistingApplication(
tenantId any,
clientId any,
) EntraIdApplicationResource
tenantIdanyThe registration's home tenant GUID or domain, as a literal or parameter.
clientIdanyThe registration's application client GUID, as a literal or parameter.
EntraIdApplicationResource

The registration builder.

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

Gets an expression for the full URI of one of this registration's scopes, such as api://{clientId}/access_as_user.
GetScopeUri(scopeName string) *ReferenceExpression
scopeNamestringThe name of a scope added with withScope.
*ReferenceExpression

An expression that resolves when the registration's application ID URI is known.

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

Publishes explicit application-role assignments to a managed identity or a compute resource's managed identity.
PublishWithAppRoleAssignment(
identity any,
roleValues []string,
) EntraIdApplicationResource
identityanyThe user-assigned identity or compute resource receiving the roles.
roleValues[]stringEnabled role values declared on this API that allow Application members.
EntraIdApplicationResource

The API registration builder.

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

Publishes managed identity federation trust for a registration created by Aspire.
PublishWithFederatedManagedIdentityCredential(options ...*PublishWithFederatedManagedIdentityCredentialOptions) EntraIdApplicationResource
options...*PublishWithFederatedManagedIdentityCredentialOptionsOptional settings, described under Options.

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

IdentityanyA compute resource whose identity to trust, an explicit user-assigned identity, or no value to trust every consumer's own identity.
EntraIdApplicationResource

The registration builder.

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

Creates and provisions a short-lived certificate credential for local development.
RunWithLocalDeveloperCertificateCredential() EntraIdApplicationResource
EntraIdApplicationResource

The resource builder for chaining.

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

methodWithAdminConsentbuilder
Grants tenant-wide consent to delegated permissions that this registration declared for another registration in the AppHost.
WithAdminConsent(
api EntraIdApplicationResource,
scopeNames []string,
) EntraIdApplicationResource
apiEntraIdApplicationResourceThe registration that exposes the scopes.
scopeNames[]stringThe names of scopes already declared with WithApiPermissions.
EntraIdApplicationResource

The resource builder for chaining.

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

Enables ACL-based authorization for daemon-to-API scenarios.
WithAllowWebApiToBeAuthorizedByACL() EntraIdApplicationResource
EntraIdApplicationResource

The resource builder for chaining.

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

methodWithApiPermissionsbuilder
Declares that this registration requires delegated permissions to scopes of another registration in the AppHost.
WithApiPermissions(
api EntraIdApplicationResource,
scopeNames []string,
) EntraIdApplicationResource
apiEntraIdApplicationResourceThe registration that exposes the scopes.
scopeNames[]stringThe names of the scopes, added with WithScope to api.
EntraIdApplicationResource

The resource builder for chaining.

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

Exposes the registration as an API identified by an application ID URI.
WithApplicationIdUri(options ...*WithApplicationIdUriOptions) EntraIdApplicationResource
options...*WithApplicationIdUriOptionsOptional settings, described under Options.

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

ApplicationIdUri*stringA custom URI, such as api://contoso-orders or https://contoso.onmicrosoft.com/orders. Omit to use the default api://{clientId}.
EntraIdApplicationResource

The registration builder.

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

Appends an application owner supplied as a literal directory object GUID or a parameter.
WithApplicationOwners(ownerObjectId any) EntraIdApplicationResource
ownerObjectIdanyThe directory object ID of a user or service principal.
EntraIdApplicationResource

The registration builder.

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

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

methodWithAudiencebuilder
Adds an accepted audience for this application.
WithAudience(audience string) EntraIdApplicationResource
audiencestringThe audience value (e.g., api://<client-id>).
EntraIdApplicationResource

The resource builder for chaining.

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

Adds a certificate credential from the certificate store by distinguished name.
WithCertificateDistinguishedName(
storePath string,
distinguishedName string,
) EntraIdApplicationResource
storePathstringThe certificate store path (e.g., "CurrentUser/My").
distinguishedNamestringThe certificate distinguished name (e.g., "CN=MyCert").
EntraIdApplicationResource

The resource builder for chaining.

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

Appends a certificate file credential. The file path is on the consuming resource, not the AppHost.
WithCertificateFromFile(
filePath string,
options ...*WithCertificateFromFileOptions,
) EntraIdApplicationResource
filePathstringThe path to the certificate file on the consumer.
options...*WithCertificateFromFileOptionsOptional settings, described under Options.

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

Password*ParameterResourceAn optional secret parameter for a password-protected certificate.
EntraIdApplicationResource

The registration builder.

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

Adds a certificate credential using a vault URL or Key Vault resource.
WithCertificateFromKeyVault(
keyVaultUrl any,
certificateName string,
) EntraIdApplicationResource
keyVaultUrlanyThe vault URL or Key Vault resource containing the certificate.
certificateNamestringThe name of the certificate in Key Vault.
EntraIdApplicationResource

The registration builder.

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

Adds a certificate credential from the certificate store by thumbprint.
WithCertificateThumbprint(
storePath string,
thumbprint string,
) EntraIdApplicationResource
storePathstringThe certificate store path (e.g., "CurrentUser/My").
thumbprintstringThe certificate thumbprint.
EntraIdApplicationResource

The resource builder for chaining.

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

Adds a client capability (e.g., "cp1" for Continuous Access Evaluation).
WithClientCapability(capability string) EntraIdApplicationResource
capabilitystringThe capability identifier.
EntraIdApplicationResource

The resource builder for chaining.

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

methodWithClientSecretbuilder
Adds a client secret credential to this Entra ID application.
WithClientSecret(clientSecret ParameterResource) EntraIdApplicationResource
clientSecretParameterResourceA secret parameter containing the client secret.
EntraIdApplicationResource

The resource builder for chaining.

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

Grants tenant-wide consent to permissions that this registration declared for an API that is not an Aspire resource.
WithExternalApiAdminConsent(
api any,
permissions []*EntraIdExternalApiPermission,
) EntraIdApplicationResource
apianyA well-known API, or an API identified by its application ID and application ID URI.
permissions[]*EntraIdExternalApiPermissionPermissions already declared with withExternalApiPermissions.
EntraIdApplicationResource

The registration builder.

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

Declares permissions to a Microsoft first-party or other API that is not an Aspire resource, such as Microsoft Graph.
WithExternalApiPermissions(
api any,
permissions []*EntraIdExternalApiPermission,
) EntraIdApplicationResource
apianyA well-known API, or an API identified by its application ID and application ID URI.
permissions[]*EntraIdExternalApiPermissionThe permissions to declare. Each is delegated unless its type is Application.
EntraIdApplicationResource

The registration builder.

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

Adds an extra query parameter to send to the identity provider.
WithExtraQueryParameter(
key string,
value string,
) EntraIdApplicationResource
keystringThe query parameter key.
valuestringThe query parameter value.
EntraIdApplicationResource

The resource builder for chaining.

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

Configures a pre-existing managed identity trust for token acquisition, without provisioning or assigning an identity.
WithFederatedManagedIdentityCredential(
managedIdentityClientId string,
options ...*EntraIdTokenExchangeOptions,
) EntraIdApplicationResource
managedIdentityClientIdstringThe client GUID of a user-assigned managed identity that the registration already trusts.
options...*EntraIdTokenExchangeOptionsOptional settings, described under Options.

Optional parameters are passed as the existing *EntraIdTokenExchangeOptions struct.

EntraIdApplicationResource

The registration builder.

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

methodWithIdTokenIssuancebuilder
Enables ID-token issuance through implicit and hybrid flows for a registration created by Aspire.
WithIdTokenIssuance() EntraIdApplicationResource
EntraIdApplicationResource

The resource builder for chaining.

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

methodWithInstancebuilder
Configures the Entra ID instance URL. Defaults to https://login.microsoftonline.com/.
WithInstance(instance string) EntraIdApplicationResource
instancestringThe Entra ID instance URL, such as https://login.microsoftonline.us/ for Azure Government or https://contoso.ciamlogin.com/ for an external tenant.
EntraIdApplicationResource

The resource builder for chaining.

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

methodWithOwnersbuilder
Appends an owner to both the application registration and service principal.
WithOwners(ownerObjectId any) EntraIdApplicationResource
ownerObjectIdanyThe directory object GUID of a user or service principal, as a literal or parameter.
EntraIdApplicationResource

The registration builder.

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

Pre-authorizes a client application to request some of this registration's scopes without any consent prompt.
WithPreAuthorizedApplication(
client EntraIdApplicationResource,
scopeNames []string,
) EntraIdApplicationResource
clientEntraIdApplicationResourceThe client application to pre-authorize.
scopeNames[]stringThe names of the scopes, added with WithScope, that the client may request.
EntraIdApplicationResource

The resource builder for chaining.

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

methodWithRedirectUrisbuilder
Appends web redirect URIs supplied as a literal, a parameter, or an endpoint.
WithRedirectUris(
redirectUri any,
options ...*WithRedirectUrisOptions,
) EntraIdApplicationResource
redirectUrianyA full URI, a parameter containing comma-separated full URIs, or an endpoint. With callback paths, a parameter supplies a host instead.
options...*WithRedirectUrisOptionsOptional settings, described under Options.

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

CallbackPaths[]stringCallback paths starting with '/'. Required for an endpoint; with a host parameter, produces HTTPS URIs. Omit for full URIs.
EntraIdApplicationResource

The registration builder.

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

methodWithScopebuilder
Exposes a delegated permission scope that clients can request to call this registration as an API.
WithScope(
name string,
description string,
options ...*EntraIdScopeOptions,
) EntraIdApplicationResource
namestringThe scope's name, which appears in the token's scp claim, such as access_as_user.
descriptionstringWhat the scope allows, shown on the consent page.
options...*EntraIdScopeOptionsOptional settings, described under Options.

Optional parameters are passed as the existing *EntraIdScopeOptions struct.

EntraIdApplicationResource

The registration builder.

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

methodWithSendX5Cbuilder
Sends the x5c claim (the public key of the certificate) with token requests.
WithSendX5C() EntraIdApplicationResource
EntraIdApplicationResource

The resource builder for chaining.

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

Appends a service principal owner supplied as a literal directory object GUID or a parameter.
WithServicePrincipalOwners(ownerObjectId any) EntraIdApplicationResource
ownerObjectIdanyThe directory object ID of a user or service principal.
EntraIdApplicationResource

The registration builder.

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

Appends a signed assertion file credential, such as an AKS workload identity token.
WithSignedAssertionFile(options ...*WithSignedAssertionFileOptions) EntraIdApplicationResource
options...*WithSignedAssertionFileOptionsOptional settings, described under Options.

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

FilePath*stringThe token file path on the consumer. Omit to use the consumer's AZURE_FEDERATED_TOKEN_FILE setting.
EntraIdApplicationResource

The registration builder.

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

methodWithSignInAudiencebuilder
Configures which accounts can sign in to this application.
WithSignInAudience(signInAudience EntraIdSignInAudience) EntraIdApplicationResource
signInAudienceEntraIdSignInAudienceThe accounts that can sign in. It must match the "Supported account types" setting of the app registration.
EntraIdApplicationResource

The resource builder for chaining.

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