Skip to content

Feature request: AI Gateway connection support #339

@audunsolemdal

Description

@audunsolemdal

📝 Description

I would like to use the new AI Gateway functionality via CAIRA.
There is a sample of this in Bicep code which can be found here https://github.com/azure-ai-foundry/foundry-samples/blob/main/infrastructure/infrastructure-setup-bicep/01-connections/apim/modules/apim-connection-common.bicep

🛰 Alternatives

No response

🚧 Potential Configuration / Desired Solution

foundry ref. architecture

variable "existing_api_management_resource_id" {
  type        = string
  description = "Existing API Management service resource ID to use for agent API calls."
}

foundry project module

variable "api_management_connection" {
  type = object({
    name        = string
    resource_id = string
    endpoint    = string
    path        = string
  })
  default     = null
  description = "Configuration for API Management connection to AI Foundry Project."
}

resource "azapi_resource" "apim_connection" {
  count = var.api_management_connection != null ? 1 : 0

  type                      = "Microsoft.CognitiveServices/accounts/projects/connections@2025-06-01"
  name                      = var.api_management_connection.name
  parent_id                 = azapi_resource.ai_foundry_project.id
  schema_validation_enabled = false

  depends_on = [
    azapi_resource.ai_foundry_project
  ]

  body = {
    name = var.api_management_connection.name
    properties = {
      category      = "ApiManagement"
      target        = "${var.api_management_connection.endpoint}${var.api_management_connection.path}"
      authType      = "ApiKey"
      isSharedToAll = false
      credentials = {
        key = "xxxx" # apim subscription key currently required for link, entra support underway.
      }
      metadata = {
        ApiType    = "Azure"
        ResourceId = var.api_management_connection.resource_id
        location   = var.location
      }
    }
  }

  response_export_values = [
    "identity.principalId"
  ]
}

📎 Additional context

No response

☑️ Acceptance Criteria

Working AIGateway connection to Azure API management

🔰 Code of Conduct

  • I agree to follow this project's Code of Conduct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/featureA new feature (job story, user story)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions