# AddKeycloak

- Module: [Aspire.Hosting.Keycloak](/reference/api/go/aspire.hosting.keycloak.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `method`
- Defined on: `DistributedApplicationBuilder`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Adds a Keycloak container to the application model.

## Definition

```go
func (DistributedApplicationBuilder) AddKeycloak(
    name string,
    options ...*AddKeycloakOptions,
) KeycloakResource
```

## Parameters

- `name` (`string`) -- The name of the resource.
- `options` (`...*AddKeycloakOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*AddKeycloakOptions` argument.

- `Port` (`*float64`) -- The host port that the underlying container is bound to when running locally.
- `AdminUsername` (`*ParameterResource`) -- The parameter used as the admin for the Keycloak resource. If `null` a default value will be used.
- `AdminPassword` (`*ParameterResource`) -- The parameter used as the admin password for the Keycloak resource. If `null` a default password will be used.

## Returns

[`KeycloakResource`](/reference/api/go/aspire.hosting.keycloak/keycloakresource.md) -- The resource builder.

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

## Applies to

- `DistributedApplicationBuilder`
