Run a Keycloak dev server instance on Azure in minutes

Nitin Manju
3 min readJul 15, 2023

Keycloak is a powerful open-source tool designed for managing user identities and access to applications. It offers a range of essential features, including secure authentication, authorization, and single sign-on convenience. With Keycloak, developers can quickly implement robust security measures and centralize user management across different platforms.

It supports multiple authentication methods, such as traditional username and password, as well as social logins and additional layers of security like multi-factor authentication. By providing a flexible architecture and seamless integration options, Keycloak simplifies the process of implementing reliable and secure identity management for modern applications.

It is easy to deploy a dev server instance of Keycloak on Azure for testing, follow on with the article to create a dev server instance running on Azure App Service with a few clicks.

Create and configure a new Web App (Azure App Service):

  1. Create a new Web App on Azure
  2. Under ‘Basics’ settings, select the ‘Subscription’
  3. Select an existing Resource Group of your choice or create new
  4. Provide a name, (eg. keycloak-devtest) and note down the fully qualified domain name that has been created. It should be: https://<name>.azurewebsites.net
  5. Select ‘Docker Conatiner’ under publish
  6. Choose ‘Linux’ as the operating system
  7. Select the ‘Region’
  8. Select the pricing plan, the free tier should work
  9. Zone Redundancy can be disabled
  10. Review the settings and click ‘Next’ and move on to Docker settings

Configure Docker settings:

  1. Select ‘Single Container’ under Options
  2. Select ‘Docker Hub’ under Image Source
  3. Select ‘Public’ under Access Type
  4. Type jboss/keycloak:latest under Image and tag
  5. Leave the startup command empty
  6. Click on ‘Review + Create’ and then ‘Create’

After successful deployment, follow the below steps.

Configure Application Settings:

  1. Navigate to the resource by clicking on ‘Go to Resource’
  2. Under Settings, click on ‘Configurations’
  3. We have to add three new ‘Application settings’ as shown below (choose your own password)
KEYCLOAK_FRONTEND_URL : https://<name>.azurewebsites.net/auth
KEYCLOAK_USER : admin
KEYCLOAK_PASSWORD: admin

That should be it. Restart the Web App and wait for the container to boot up (Free tier takes more time). On successful boot, the container should be ready to accept new requests.

View the deployment logs:

To view the deployment and container logs, navigate to ‘Deployment Center’ and click on logs

Note 1: This is to be used as a dev server instance only. Do not use it for the production use case.

Note 2: By default, Keycloak uses the H2 database in the dev-server instance, data will not be persisted after the container/web app is restarted.

--

--