Compartilhar via


KeycloakResourceBuilderExtensions.AddKeycloak Method

Definition

Adds a Keycloak container to the application model.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.KeycloakResource> AddKeycloak (this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, int? port = default, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>? adminUsername = default, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>? adminPassword = default);
static member AddKeycloak : Aspire.Hosting.IDistributedApplicationBuilder * string * Nullable<int> * Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> * Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.KeycloakResource>
<Extension()>
Public Function AddKeycloak (builder As IDistributedApplicationBuilder, name As String, Optional port As Nullable(Of Integer) = Nothing, Optional adminUsername As IResourceBuilder(Of ParameterResource) = Nothing, Optional adminPassword As IResourceBuilder(Of ParameterResource) = Nothing) As IResourceBuilder(Of KeycloakResource)

Parameters

name
String

The name of the resource.

port
Nullable<Int32>

The host port that the underlying container is bound to when running locally.

adminUsername
IResourceBuilder<ParameterResource>

The parameter used as the admin for the Keycloak resource. If null a default value will be used.

adminPassword
IResourceBuilder<ParameterResource>

The parameter used as the admin password for the Keycloak resource. If null a default password will be used.

Returns

A reference to the IResourceBuilder<T>.

Examples

Use in application host

var keycloak = builder.AddKeycloak("keycloak");

var myService = builder.AddProject<Projects.MyService<()
                       .WithReference(keycloak);

Remarks

The container exposes port 8080 by default. This version of the package defaults to the tag of the / container image.

Applies to