# How to link organization with idp using admin client java

**URL:** <https://forum.keycloak.org/t/how-to-link-organization-with-idp-using-admin-client-java/31254>\
**Category:** Getting advice\
**Tags:** authentication, identity-brokering\
**Created:** [January 19, 2026, 12:23pm UTC](https://forum.keycloak.org/t/how-to-link-organization-with-idp-using-admin-client-java/31254 "2026-01-19T12:23:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tania](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tania/32/9460_2.png) [@tania](https://forum.keycloak.org/u/tania)\
**Post date:** [January 19, 2026, 12:23pm UTC](https://forum.keycloak.org/t/how-to-link-organization-with-idp-using-admin-client-java/31254/1 "2026-01-19T12:23:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![phormanns](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/phormanns/32/12489_2.png) [@phormanns](https://forum.keycloak.org/u/phormanns)\
**Post date:** [February 25, 2026, 8:13pm UTC](https://forum.keycloak.org/t/how-to-link-organization-with-idp-using-admin-client-java/31254/2 "2026-02-25T20:13:25Z")

</div>

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

Any ideas?

Thank you for reading

---

<div class="post-metadata">

**Author:** ![embesozzi](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/embesozzi/32/12390_2.png) [@embesozzi](https://forum.keycloak.org/u/embesozzi)\
**Post date:** [February 25, 2026, 10:06pm UTC](https://forum.keycloak.org/t/how-to-link-organization-with-idp-using-admin-client-java/31254/3 "2026-02-25T22:06:20Z")

</div>

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

```bash
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}

```

---

<div class="post-metadata">

**Author:** ![phormanns](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/phormanns/32/12489_2.png) [@phormanns](https://forum.keycloak.org/u/phormanns)\
**Post date:** [February 26, 2026, 6:25pm UTC](https://forum.keycloak.org/t/how-to-link-organization-with-idp-using-admin-client-java/31254/4 "2026-02-26T18:25:57Z")

</div>

Thank you, works for me!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/keycloak/original/1X/eb342909d95cf32cbb7517610022c6a0046a9ffb.png) [@system](https://forum.keycloak.org/u/system)\
**Post date:** [August 25, 2026, 6:26pm UTC](https://forum.keycloak.org/t/how-to-link-organization-with-idp-using-admin-client-java/31254/5 "2026-08-25T18:26:57Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
