Skip to content

feat(opencode): added in oauth connection for azure provider through MS Entra ID and az cli#31351

Open
OpeOginni wants to merge 22 commits into
anomalyco:devfrom
OpeOginni:feat/azure-oauth
Open

feat(opencode): added in oauth connection for azure provider through MS Entra ID and az cli#31351
OpeOginni wants to merge 22 commits into
anomalyco:devfrom
OpeOginni:feat/azure-oauth

Conversation

@OpeOginni

@OpeOginni OpeOginni commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #31342
Closes #21658

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This PR adds another login method for the Azure and Azure Cognitive Services providers.

This would be an alternative for teams that don't have access to API keys for the deployed resources.

  • Adds instructions and link to Azure docs explaining how to setup proper Roles to use the Resources
  • Makes use of the az cli and Bun Spawn to get the access keys to be used, tried the @azure/identity package, but would make Bun and the TUI to crash.
  • Updated docs to show that this is now an option.
  • Checks if az command can be called,a nd returns error message if not found on the user's machine.

How did you verify your code works?

Tested locally but logging in fresh to the azure provider using the Oauth method, after completely logging in on the az cli

Screenshots / recordings

Screen.Recording.2026-06-08.at.12.58.05.mov

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@Uranium2

Copy link
Copy Markdown

Can someone check this and try to include in the next realeases? A lot of people are blocked with the new GitHub Copilot pricing policy and would like to use Azure OpenAI and have security policy constraints on using API keys.

@rekram1-node

Copy link
Copy Markdown
Collaborator

/review

Comment thread packages/opencode/src/plugin/azure.ts Outdated
@rekram1-node

Copy link
Copy Markdown
Collaborator

/review

Comment thread packages/opencode/src/provider/provider.ts
@rekram1-node

Copy link
Copy Markdown
Collaborator

Reviewed the current head and found no remaining actionable correctness issues. The earlier Azure Cognitive Services endpoint substitution problem is fixed by the new vars loader. Residual risk: the new Azure CLI token acquisition, expiry caching, and refresh path has no automated coverage in this PR.

@Uranium2

Copy link
Copy Markdown

What's the blocking point to merge this? The Windows test does not seem related to this feature

@Uranium2

Copy link
Copy Markdown

Still no news to merge this useful feature? Some people can't use KeyID from Azure and are stuck. Claude cli has this feature now

@OpeOginni

Copy link
Copy Markdown
Contributor Author

Still no news to merge this useful feature? Some people can't use KeyID from Azure and are stuck. Claude cli has this feature now

Team is a bit focused on V2, but I will give it a push to them a bit later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Azure AI Foundry Microsoft Entra (OAuth) authentication Use OpenAI Azure without APIKEY

3 participants