Damith Udayanga
Damith Udayanga

Reputation: 924

Configure SQL Server with Azure Active Directory Service Principal authentication for Keycloak

I have an SQL Server database hosted on azure. It can access using the Azure Active Directory Service Principal. I'm trying to deploy keycloak (16.1.0) on AKS and configure the database mentioned earlier. I have an application that can connect to that SQL Server using the Azure Active Directory Service Principal. But using keycloak, it has no luck.

I have used JDBC_PARAMS="authentication=ActiveDirectoryServicePrincipal" to configure database properties in keycloak.

Thanks

Upvotes: 1

Views: 2426

Answers (1)

Vamsi Bitra
Vamsi Bitra

Reputation: 2764

Deploying keycloak on AKS

Please Follow this doc:

Connect to that SQL Server using the Azure Active Directory Service Principal

Active Directory Service Principal authentication mode, the client application can connect to Azure SQL data sources by providing the client ID and secret of a service principal identity. Service principal authentication involves:

  1. Setting up an app registration with a secret.

  2. Granting permissions to the app in the Azure SQL Database instance.

  3. Connecting with the correct credential.

Grant access to Azure SQL Database

We need to give your application access to the Azure SQL Database service. This is done through the API Permissions.

Reference 1

Add client authentication

In order to authenticate Active Directory representation of it, switch over to Certificates and create a New client secret.

The following example shows how to use Active Directory Service Principal authentication

Reference 2

The following example shows how to use Active Directory Service Principal authentication.

// Use your own server, database, app ID, and secret.
string ConnectionString = @"Server=demo.database.windows.net; Authentication=Active Directory Service Principal; Database=testdb; User Id=App Id; Password=secret";

using (SqlConnection conn = new SqlConnection(ConnectionString)) {
    conn.Open();
}

Refer this link .

Upvotes: 1

Related Questions