Skip to content

Azure Government OpenAI Foundry Connection no Longer Functional #37166

Description

@lambertaa

Description

There has never been specific support for Azure Foundry OpenAI deployment in Azure GovCloud, however I used to be able to get it to work with this config:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "azure/gpt-5.1",
  "autoupdate": false,
  "provider": {
    "azure": {
      "options": {
        "apiKey": "<my api key>",
        "baseURL": "https://<resource-name>.openai.azure.us/openai"
      },
      "models": {
        "gpt-5.1": "gpt-5.1"
      }
    }
  }
}

Recently, I started getting a "resource not found error". I think something has changed with the SDK or with Azure's API making opencode incompatible with Azure GovCloud OpenAI deployments. I tried adding the resourceName, apiVersion, and other arguments with no success. I have downgraded to a previous version without success as well.

At the core of the issue is the fact that the base url or endpoint for gov cloud is different (azure.us vs azure.com). If we could add specific support for govcloud where the resource name is only required, similar to how it works for the standard azure provider, that would be fantastic.

Plugins

No response

OpenCode version

1.18.2

Steps to reproduce

  1. Use this config in your opencode.jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "model": "azure/gpt-5.1",
  "autoupdate": false,
  "provider": {
    "azure": {
      "options": {
        "apiKey": "<my api key>",
        "baseURL": "https://<resource-name>.openai.azure.us/openai"
      },
      "models": {
        "gpt-5.1": "gpt-5.1"
      }
    }
  }
}
  1. Run a test
opencode run "I am going to Paris, what should I see?" --model azure/gpt-5.1 --print-logs --log-level DEBUG --pure
  1. Depending on configuration changes, I will either get "Resource not Found" error, or problems connecting to the API at all

Screenshot and/or share link

No response

Operating System

mac OS 26.5.2

Terminal

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions