Share via


AzureUserAssignedIdentityExtensions.WithAzureUserAssignedIdentity<T> Method

Definition

Attaches an existing AzureUserAssignedIdentityResource to a compute resource, setting it as the target identity for the builder.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<T> WithAzureUserAssignedIdentity<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T> builder, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzureUserAssignedIdentityResource> identityResourceBuilder) where T : Aspire.Hosting.ApplicationModel.IComputeResource;
static member WithAzureUserAssignedIdentity : Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IComputeResource)> * Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzureUserAssignedIdentityResource> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IComputeResource)> (requires 'T :> Aspire.Hosting.ApplicationModel.IComputeResource)
<Extension()>
Public Function WithAzureUserAssignedIdentity(Of T As IComputeResource) (builder As IResourceBuilder(Of T), identityResourceBuilder As IResourceBuilder(Of AzureUserAssignedIdentityResource)) As IResourceBuilder(Of T)

Type Parameters

T

Parameters

builder
IResourceBuilder<T>

The builder for the IComputeResource the identity will be associated with.

Returns

A reference to the IResourceBuilder<T> builder.

Examples

var identity = builder.AddAzureUserAssignedIdentity("myIdentity");
var app = builder.AddProject("myApp")
    .WithAzureUserAssignedIdentity(identity);

Applies to