feat(opencode): support Azure CLI authentication - #45079
Open
opencode-agent[bot] wants to merge 6 commits into
Open
feat(opencode): support Azure CLI authentication#45079opencode-agent[bot] wants to merge 6 commits into
opencode-agent[bot] wants to merge 6 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
N/A
Type of change
What does this PR do?
Adds Microsoft Entra ID authentication through an existing Azure CLI session to the Azure provider while preserving the current API-key flow.
az logincredentials and cached, automatically refreshed bearer tokens with the correct Azure OpenAI and Microsoft Foundry audiences.AZURE_RESOURCE_GROUPto bypass subscription-wide account enumeration when the resource group is already known.expires_ontimestamps and the legacyexpiresOnformat.The authentication and fallback approach follows documented patterns from Claude Code on Microsoft Foundry, the GitHub Copilot SDK Azure managed identity integration, and the AI SDK Azure provider: renewable bearer credentials, explicit deployment names, and no requirement for model-discovery permissions to perform inference.
How did you verify your code works?
bun test test/plugin/azure.test.ts test/provider/provider.test.ts --test-name-pattern 'plugin.azure|Azure'— 12 passing tests covering authentication, token audiences, legacy token expiration, direct resource-group lookup, duplicate deployments, discovery fallback, and existing Azure provider behavior.bun typecheckcovering the changed provider/plugin files and Azure tests.bun x prettier --check packages/opencode/src/plugin/azure.ts packages/opencode/src/provider/provider.ts packages/opencode/test/plugin/azure.test.ts packages/web/src/content/docs/providers.mdxgit diff --check origin/devScreenshots / recordings
N/A
Checklist
Requested by: @neriousy (Filip via Slack)