Skip to content

Use Entra ID auth for Azure OpenAI in notebook tests - #2640

Closed
Dayenne Souza (dayesouza) wants to merge 4 commits into
mainfrom
notebook-tests-entra-auth
Closed

Dayenne Souza (dayesouza) wants to merge 4 commits into
mainfrom
notebook-tests-entra-auth

Conversation

@dayesouza

Copy link
Copy Markdown
Contributor

Description

Switch the notebook tests from API-key auth to Entra ID auth for Azure OpenAI. The workflow now logs in to Azure with OIDC and no longer passes GRAPHRAG_API_KEY.

Related Issues

None.

Proposed Changes

  • Add id-token: write to the workflow permissions.
  • Add an azure/login step (v3.1.0, pinned to its commit SHA) before the notebook test, using the AZURE_CLIENT_ID, AZURE_TENANT_ID and AZURE_SUBSCRIPTION_ID secrets.
  • Remove GRAPHRAG_API_KEY from the job environment. GRAPHRAG_API_BASE is unchanged.

No notebook changes are needed: the packages/graphrag-llm/notebooks notebooks already use AuthMethod.AzureManagedIdentity when GRAPHRAG_API_KEY is not set, and DefaultAzureCredential picks up the Azure CLI login.

Checklist

  • I have tested these changes locally.
  • I have reviewed the code changes.
  • I have updated the documentation (if necessary).
  • I have added appropriate unit tests (if applicable).

Additional Notes

  • Tested locally with az login and no API key set: uv run poe test_notebook gave 12 passed. The OIDC login itself can only be exercised in CI, so this PR's run is its first test.
  • The federated credential currently covers pull requests only. A credential for refs/heads/main is needed before the post-merge run on main can log in.
  • PRs from forks cannot get an OIDC token, so this job will fail at login for fork PRs (they could not read the API key secret before either).
  • gh-pages.yml still uses GRAPHRAG_API_KEY, and the smoke tests will move in a follow-up PR.

🤖 Generated with Claude Code

Log in to Azure with OIDC and stop passing GRAPHRAG_API_KEY, so the
graphrag-llm notebooks take their existing managed-identity path.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@dayesouza
Dayenne Souza (dayesouza) requested a review from a team as a code owner November 25, 2026 13:42
Confirms which identity the OIDC login uses. Revert before merge.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Scopes the Azure OIDC subject to the environment so one federated
credential covers pull requests and main.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@dayesouza

Copy link
Copy Markdown
Contributor Author

Closing in favor of #2641. Entra ID login from GitHub-hosted Actions runners is blocked by the tenant's Conditional Access policy (AADSTS53003), so this approach cannot pass. #2641 runs the same tests in Azure DevOps, where the login works.

This branch had an error being deployed

1 failed deployment
integration — 71b509b6 Deployed Nov 25, 2026 by dayesouza via python-ci (3.13, ubuntu-latest) #3504
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant