Skip to content

fix: add OAuth, audience, connectorName fields and full authType enum to ConnectionConfig#51

Merged
trangevi merged 2 commits into
Azure-Samples:mainfrom
lindazqli:fix/connection-oauth-audience-fields
Apr 13, 2026
Merged

fix: add OAuth, audience, connectorName fields and full authType enum to ConnectionConfig#51
trangevi merged 2 commits into
Azure-Samples:mainfrom
lindazqli:fix/connection-oauth-audience-fields

Conversation

@lindazqli

Copy link
Copy Markdown
Contributor

Problem

The ConnectionConfig Bicep type is missing several fields that the Azure AI Projects REST API accepts. When users specify these fields in their azure.yaml, the azd extension reads them into Go structs, then passes them to Bicep as parameters — but because the Bicep type doesn't declare them, the values are silently dropped and never reach the ARM deployment.

The affected fields are:

Field Auth type Purpose
authorizationUrl OAuth2 OAuth2 authorization endpoint
tokenUrl OAuth2 OAuth2 token endpoint
refreshUrl OAuth2 OAuth2 token refresh endpoint
scopes OAuth2 OAuth2 requested scopes
audience UserEntraToken, AgenticIdentity Token audience claim
connectorName OAuth2 (managed) Managed connector identifier

Additionally, the authType union was missing several values the REST API accepts:
UserEntraToken, AgenticIdentity, ManagedIdentity, ServicePrincipal, UsernamePassword, AccessKey, AccountKey, SAS.

Changes

  • Extend ConnectionConfig type with 6 optional fields: authorizationUrl?, tokenUrl?, refreshUrl?, scopes?, audience?, connectorName?
  • Expand authType union to cover all known auth type values
  • Add corresponding spread entries in the connection resource properties block so that each new field is forwarded to ARM when provided

Testing

Verified against the Azure AI Projects REST API (2025-04-01-preview) — all new fields map to documented connection properties.

Add missing fields to the Bicep ConnectionConfig type so that all
connection properties defined in azure.yaml are passed through to the
ARM API without being silently dropped:

- authorizationUrl / tokenUrl / refreshUrl / scopes  (OAuth2 flows)
- audience   (UserEntraToken / AgenticIdentity auth types)
- connectorName  (managed OAuth connectors)

Also extend the authType union to include all values the REST API
accepts: UserEntraToken, AgenticIdentity, ManagedIdentity,
ServicePrincipal, UsernamePassword, AccessKey, AccountKey, SAS.

@therealjohn therealjohn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks

nit: avoid whitespace issues to make the diff cleaner

@trangevi
trangevi merged commit 8b3bdd8 into Azure-Samples:main Apr 13, 2026
1 check passed
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.

3 participants