|
| 1 | +--- |
| 2 | +description: How to configure Azure Entra Authentication |
| 3 | +--- |
| 4 | + |
| 5 | +# Azure Entra |
| 6 | + |
| 7 | +## Overview |
| 8 | +Kafbat UI comes with an OAuth Callback Handler for |
| 9 | +[Azure Event Hubs for Kafka](https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/migrate-kafka-to-passwordless-connection?tabs=azure-portal%2Csign-in-azure-cli%2Cjava-kafka%2Capp-service%2Cassign-role-service-connector). |
| 10 | + |
| 11 | +The Callback Handler uses the |
| 12 | +[Default Azure Credential](https://learn.microsoft.com/en-us/azure/developer/java/sdk/identity-azure-hosted-auth#default-azure-credential) for authentication, |
| 13 | +providing support for all commonly used Entra credentials. |
| 14 | + |
| 15 | +Pre-requisites: |
| 16 | +1. An Event Hub Namespace in the standard, premium or dedicated tiers. |
| 17 | +2. An Event Hub. |
| 18 | +3. Entra Credentials for an Entra Identity with a role assignment allowing |
| 19 | + sending to and receiving from Event Hub, such as Azure Event Hubs Data Owner. |
| 20 | + |
| 21 | +## Examples |
| 22 | + |
| 23 | +Please replace `<EVENT HUB NAMESPACE NAME>` with the name of your Event Hub namespace. |
| 24 | + |
| 25 | +Prior to starting Kafbat UI, authenticate with Azure Entra using any of the supported |
| 26 | +Azure Credential types (Environment Variable, Managed Identity, Azure CLI, etc.). |
| 27 | +See [Default Azure Credential](https://learn.microsoft.com/en-us/azure/developer/java/sdk/identity-azure-hosted-auth#default-azure-credential) |
| 28 | +for additional configuration required based on the credential type. |
| 29 | + |
| 30 | +As an example, after authenticating with the Azure CLI using `az login` Kafbat UI will |
| 31 | +automatically connect to Event Hubs using CLI credentials. |
| 32 | + |
| 33 | +### Docker |
| 34 | + |
| 35 | +```bash |
| 36 | +docker run -p 8080:8080 \ |
| 37 | + -e KAFKA_CLUSTERS_0_NAME=local \ |
| 38 | + -e KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=<EVENT HUB NAMESPACE NAME>.servicebus.windows.net:9093 \ |
| 39 | + -e KAFKA_CLUSTERS_0_PROPERTIES_SECURITY_PROTOCOL=SASL_SSL \ |
| 40 | + -e KAFKA_CLUSTERS_0_PROPERTIES_SASL_MECHANISM=OAUTHBEARER \ |
| 41 | + -e KAFKA_CLUSTERS_0_PROPERTIES_SASL_CLIENT_CALLBACK_HANDLER_CLASS=io.kafbat.ui.config.auth.azure.AzureEntraLoginCallbackHandler \ |
| 42 | + -e KAFKA_CLUSTERS_0_PROPERTIES_SASL_JAAS_CONFIG="org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required;" \ |
| 43 | + -d ghcr.io/kafbat/kafka-ui |
| 44 | +``` |
| 45 | + |
| 46 | +### application.yaml |
| 47 | +```yaml |
| 48 | +kafka: |
| 49 | + clusters: |
| 50 | + - bootstrapServers:<EVENT HUB NAMESPACE NAME>.servicebus.windows.net:9093 |
| 51 | + name: local |
| 52 | + properties: |
| 53 | + security.protocol: SASL_SSL |
| 54 | + sasl.mechanism: OAUTHBEARER |
| 55 | + sasl.jaas.config: |
| 56 | + org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required; |
| 57 | + sasl.client.callback.handler.class: io.kafbat.ui.config.auth.azure.AzureEntraLoginCallbackHandler |
| 58 | + readOnly: false |
| 59 | +``` |
0 commit comments