PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, September 27, 2022

[FIXED] how to register a client on keycloack automatically during continous delivery?

 September 27, 2022     azure-devops, continuous-deployment, keycloak     No comments   

Issue

I am planing to work on continuous delivery of my apis and backoffice js-spa applications with Azure pipelines. I am wondering how and if it is recommanded to automate also client registration for my apis on keycloack. What is the best way to automate this part of the deployment ?


Solution

As far as I know, keycloak is a local server. So in order to use keycloak , you need to create a self-hosted agent, and then you can run the CD(continous delivery) pipeline on it.

In Azure Pipeline, there is no pipeline task out of the box to support keycloak Client Registration.

You need to run the CURL script to Client Registration in PowerShell task/Bash task/Command Line task .

Here is an example:

curl -X POST \
    -d '{ "clientId": "$(myclient)" }' \
    -H "Content-Type:application/json" \
    -H "Authorization: bearer xxtokenxx" \
    http://localhost:8080/auth/realms/master/clients-registrations/default

You could create a variable(logging command) with the client. Then you could use the variable in CURL script.

For example:

echo "##vso[task.setvariable variable=myclient;]Client content"

You could use $(myclient) in the next task.



Answered By - Kevin Lu-MSFT
Answer Checked By - Marie Seifert (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing