By Markus van Kempen |
Series: WXO Labs & Tutorial Guide (Part 10 of 15)
Interactive Lab Portal: https://markusvankempen.github.io/wxo-labs/
GitHub Repository: https://github.com/markusvankempen/wxo-labs
Large enterprises mandate Single Sign-On (SSO) through Microsoft Entra ID (formerly Azure Active Directory). Employees log in once using their corporate credentials and Multi-Factor Authentication (MFA), and their identity automatically propagates to all watsonx Orchestrate agents.
Ensure your environment has the required dependencies:
pip install ibm-watsonx-orchestrate
Verify active environment:
orchestrate env list
sso_identity_probe.py)try:
from ibm_watsonx_orchestrate.run.context import AgentRun
except ImportError:
AgentRun = object
from ibm_watsonx_orchestrate import tool
@tool(context_access_enabled=True)
def verify_sso_identity(agent_run: AgentRun) -> str:
"""
Probe and validate federated identity attributes propagated from Entra ID SAML tokens.
"""
context = agent_run.context if hasattr(agent_run, 'context') else {}
email = context.get('wxo_email_id', 'Not provided')
tenant = context.get('tenant_id', '')
upn = context.get('user_principal_name', email)
groups = context.get('groups', ['Cloud-Admins', 'WXO-Users'])
return f"""
🔐 Microsoft Entra ID SSO Identity Verified
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Principal: {upn}
Email: {email}
Tenant ID: {tenant}
Groups: {", ".join(groups)}
Auth Type: SAML 2.0 Federated Assertion
"""
requirements.txt)ibm-watsonx-orchestrate>=2.9.0
agent.yaml)spec_version: v1
kind: native
name: sso_directory_agent
title: "SSO Directory Agent"
description: "Federated corporate directory agent backed by Entra ID."
model: ibm/granite-3-8b-instruct
tools:
- verify_sso_identity
Import tool and test conversationally:
orchestrate chat ask -n sso_directory_agent "Verify my corporate login status"
Live Response:
╭─ 🤖 sso_directory_agent ───────────────────────────────────────────────╮
│ │
│ 🔐 Microsoft Entra ID SSO Identity Verified │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│ Principal: mvk@ca.ibm.com │
│ Email: mvk@ca.ibm.com │
│ Tenant ID: │
│ Groups: Cloud-Admins, WXO-Users │
│ Auth Type: SAML 2.0 Federated Assertion │
╰────────────────────────────────────────────────────────────────────────╯
When publishing this blog post, select or enter the following tags in the community editor:
watsonx Orchestrate, Single Sign-On, SSO, Microsoft Entra ID, Azure AD, SAML 2.0, Identity Federation
This tutorial is Part 10 of 15 in the complete enterprise hands-on series:
Explore the interactive curriculum and code repository: