# KeycloakResourceBuilderExtensions

- Kind: `class`
- Package: [Aspire.Hosting.Keycloak](/reference/api/csharp/aspire.hosting.keycloak.md)
- Version: `13.4.0-preview.1.26281.18`
- Namespace: `Aspire.Hosting`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/becb48e2d61099e35ae336d527d3875e928d6594/src/Aspire.Hosting.Keycloak/KeycloakResourceBuilderExtensions.cs)

Provides extension methods for adding Keycloak resources to an `Hosting.IDistributedApplicationBuilder`.

## Definition

```csharp
namespace Aspire.Hosting;

public static class KeycloakResourceBuilderExtensions
{
    // ...
}
```

## Methods

- [AddKeycloak(IDistributedApplicationBuilder, string, int?, IResourceBuilder<ParameterResource>, IResourceBuilder<ParameterResource>)](/reference/api/csharp/aspire.hosting.keycloak/keycloakresourcebuilderextensions/methods.md#addkeycloak-idistributedapplicationbuilder-string-int-iresourcebuilder-parameterresource-iresourcebuilder-parameterresource) : `IResourceBuilder<KeycloakResource>` `extension` `ats export` -- Adds a Keycloak container to the application model.
- [WithDataBindMount(IResourceBuilder<KeycloakResource>, string)](/reference/api/csharp/aspire.hosting.keycloak/keycloakresourcebuilderextensions/methods.md#withdatabindmount-iresourcebuilder-keycloakresource-string) : `IResourceBuilder<KeycloakResource>` `extension` `ats export` -- Adds a bind mount for the data folder to a Keycloak container resource.
- [WithDataVolume(IResourceBuilder<KeycloakResource>, string?)](/reference/api/csharp/aspire.hosting.keycloak/keycloakresourcebuilderextensions/methods.md#withdatavolume-iresourcebuilder-keycloakresource-string) : `IResourceBuilder<KeycloakResource>` `extension` `ats export` -- Adds a named volume for the data folder to a Keycloak container resource.
- [WithDisabledFeatures(IResourceBuilder<KeycloakResource>, string[])](/reference/api/csharp/aspire.hosting.keycloak/keycloakresourcebuilderextensions/methods.md#withdisabledfeatures-iresourcebuilder-keycloakresource-string) : `IResourceBuilder<KeycloakResource>` `extension` `ats export` -- Additional feature names to disable for the keycloak resource
- [WithEnabledFeatures(IResourceBuilder<KeycloakResource>, string[])](/reference/api/csharp/aspire.hosting.keycloak/keycloakresourcebuilderextensions/methods.md#withenabledfeatures-iresourcebuilder-keycloakresource-string) : `IResourceBuilder<KeycloakResource>` `extension` `ats export` -- Additional feature names to enable for the keycloak resource
- [WithOtlpExporter(IResourceBuilder<KeycloakResource>)](/reference/api/csharp/aspire.hosting.keycloak/keycloakresourcebuilderextensions/methods.md#withotlpexporter-iresourcebuilder-keycloakresource) : `IResourceBuilder<KeycloakResource>` `extension` `ats ignored` -- Injects the appropriate environment variables to allow the resource to enable sending telemetry to the dashboard. 1. It ensures the "opentelemetry" Keycloak feature is enabled 2. It sets the OTLP endpoint to the value of the `ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL` environment variable. 3. It sets the service name and instance id to the resource name and UID. Values are injected by the orchestrator. 4. It sets a small batch schedule delay in development. This reduces the delay that OTLP exporter waits to sends telemetry and makes the dashboard telemetry pages responsive.
- [WithOtlpExporter(IResourceBuilder<KeycloakResource>, OtlpProtocol)](/reference/api/csharp/aspire.hosting.keycloak/keycloakresourcebuilderextensions/methods.md#withotlpexporter-iresourcebuilder-keycloakresource-otlpprotocol) : `IResourceBuilder<KeycloakResource>` `extension` `ats ignored` -- Injects the appropriate environment variables to allow the resource to enable sending telemetry to the dashboard. 1. It ensures the "opentelemetry" Keycloak feature is enabled 2. It sets the OTLP endpoint to the value of the `ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL` environment variable. 3. It sets the service name and instance id to the resource name and UID. Values are injected by the orchestrator. 4. It sets a small batch schedule delay in development. This reduces the delay that OTLP exporter waits to sends telemetry and makes the dashboard telemetry pages responsive.
- [WithRealmImport(IResourceBuilder<KeycloakResource>, string, bool)](/reference/api/csharp/aspire.hosting.keycloak/keycloakresourcebuilderextensions/methods.md#withrealmimport-iresourcebuilder-keycloakresource-string-bool) : `IResourceBuilder<KeycloakResource>` `extension` `obsolete` -- Adds a realm import to a Keycloak container resource.
- [WithRealmImport(IResourceBuilder<KeycloakResource>, string)](/reference/api/csharp/aspire.hosting.keycloak/keycloakresourcebuilderextensions/methods.md#withrealmimport-iresourcebuilder-keycloakresource-string) : `IResourceBuilder<KeycloakResource>` `extension` `ats ignored` -- Adds a realm import to a Keycloak container resource.
