Skip to content

Question: how to get the deployment endpoint and key using Terraform? #417

@mariusgiger

Description

@mariusgiger

Hi,

Thanks for setting up this examples repository. It was helpful to quickly get started with Microsoft Foundry.

I was wondering how to get the model endpoint and key for a deployed model using Terraform?

resource "azurerm_cognitive_deployment" "aifoundry_deployment_gpt_4o" {
  depends_on = [
    azurerm_cognitive_account.ai_foundry
  ]

  name                 = "gpt-4o"
  cognitive_account_id = azurerm_cognitive_account.ai_foundry.id

  sku {
    name     = "GlobalStandard"
    capacity = 1
  }

  model {
    format  = "OpenAI"
    name    = "gpt-4o"
    version = "2024-11-20"
  }
}

I would expect to somehow get the Endpoint Target URI (e.g. https://<customSubDomainName>.cognitiveservices.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2025-01-01-preview) and Endpoint Key in the attributes of the response.

Cheers,
Marius

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions