How to link organization with idp using admin client java

Hello,
I would like to link an organization with a google identity provider, when i set up my realm via admin client java client.

I have created successfully the organization and the identity provider themselves, but i don’t find how to connect them after their creation.
I know how to do this via the ui, but i want to have it automatically via the admin client.

Please advise.

Thank you in advance

Same problem here: How to link an identity provider to an organization using ‘kcadm.sh’?

Any ideas?

Thank you for reading

This was a long time ago for a PoC, since you usually manage the configuration with the KC Terraform Provider.

kcadm create realms/{YOUR_REALM}/organizations -f - << EOF
{
  "name": "twogenidlabs",
  "enabled": true,
  "domains": [
    {
      "name": "twogenidlabs.com"
    }
  ]
}
EOF

ORG_ID=$(kcadm get organizations -r {YOUR_REALM} -q search='twogenidlabs' --fields 'id' --format csv --noquotes)

kcadm create realms/{YOUR_REALM}/organizations/${ORG_ID}/identity-providers -b {YOUR_IDP}
1 Like

Thank you, works for me!