How to set up an Azure Foundry (Cognitive Services) model on windows #8333

Closed
opened 2026-02-16 18:09:42 -05:00 by yindo · 2 comments
Owner

Originally created by @ilrenzo on GitHub (Feb 2, 2026).

Originally assigned to: @jayair on GitHub.

Question

Hi,
I've deployed a gpt5.1-codex model on Azure Foundry.
I have the following info from Azure Foundry:

  • Target URI: "my-service.cognitiveservices.azure.com"
  • Model: "gpt-5.1-codex"
  • API KEY
  • Deployment name: "my-service"

When I try to add this model from Azure in opencode it only asks me for the API KEY. I select the the gpt 5.1 Codex model in the chat from Azure Cognitive Services and it says:

"AI_LoadSettingError: Azure OpenAI resource name setting is missing. Pass it using the 'resourceName' parameter or the AZURE_RESOURCE_NAME environment variable."

Image

I've tried to set this AZURE_RESOURCE_NAME in various places:

  • As an environment var. I verified the environment variable was set correctly as "my-service".
  • I created an opencode.json file in the project's folder trying different json structures

Nothing worked. Still getting the same message.

Also, in windows I can't find any file with my settings and the API key that I can modify.

Any help on how to proceed?

Originally created by @ilrenzo on GitHub (Feb 2, 2026). Originally assigned to: @jayair on GitHub. ### Question Hi, I've deployed a gpt5.1-codex model on Azure Foundry. I have the following info from Azure Foundry: - Target URI: "my-service.cognitiveservices.azure.com" - Model: "gpt-5.1-codex" - API KEY - Deployment name: "my-service" When I try to add this model from Azure in opencode it only asks me for the API KEY. I select the the gpt 5.1 Codex model in the chat from Azure Cognitive Services and it says: _"AI_LoadSettingError: Azure OpenAI resource name setting is missing. Pass it using the 'resourceName' parameter or the AZURE_RESOURCE_NAME environment variable."_ <img width="833" height="154" alt="Image" src="https://github.com/user-attachments/assets/6b3c9735-ef07-438b-b397-ae24bc357b06" /> I've tried to set this AZURE_RESOURCE_NAME in various places: - As an environment var. I verified the environment variable was set correctly as "my-service". - I created an opencode.json file in the project's folder trying different json structures Nothing worked. Still getting the same message. Also, in windows I can't find any file with my settings and the API key that I can modify. Any help on how to proceed?
yindo added the windowsdocs labels 2026-02-16 18:09:42 -05:00
yindo closed this issue 2026-02-16 18:09:42 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 2, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #10895: Azure Devops Pipeline - Similar Azure resource name configuration issue in CI/CD environment
  • #10281: GPT codex fails on gitlab pipeline - Azure Cognitive Services model configuration problems
  • #6615: Deepseek v3.2 - Azure Foundry - Related Azure Foundry model setup and configuration

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 2, 2026): This issue might be a duplicate of existing issues. Please check: - #10895: Azure Devops Pipeline - Similar Azure resource name configuration issue in CI/CD environment - #10281: GPT codex fails on gitlab pipeline - Azure Cognitive Services model configuration problems - #6615: Deepseek v3.2 - Azure Foundry - Related Azure Foundry model setup and configuration Feel free to ignore if none of these address your specific case.
Author
Owner

@ilrenzo commented on GitHub (Feb 5, 2026):

Hi,
I've finally figured out. In windows it doesn't create any opencode.json file but if you create one and put this in your project root, it works:
{
"$schema": "https://opencode.ai/config.json",
"model": "gpt-5.1-codex",
"theme": "opencode",
"autoupdate": true,
"provider": {
"azure-cognitive-services": {
"options": {
"apiKey": "-redacted-",
"resourceName": "my-service"
},
"models": {
"gpt-5.1-codex": {
"name": "gpt-5.1-codex"
}
}
}
}
}

Where resource name is the first part of your Target URI in Foundry: https://my-service.cognitiveservices.azure.com.
Do not put any base url as it will build it itself using the resourceName.

@ilrenzo commented on GitHub (Feb 5, 2026): Hi, I've finally figured out. In windows it doesn't create any opencode.json file but if you create one and put this in your project root, it works: { "$schema": "https://opencode.ai/config.json", "model": "gpt-5.1-codex", "theme": "opencode", "autoupdate": true, "provider": { "azure-cognitive-services": { "options": { "apiKey": "-redacted-", "resourceName": "my-service" }, "models": { "gpt-5.1-codex": { "name": "gpt-5.1-codex" } } } } } Where resource name is the first part of your Target URI in Foundry: https://**my-service**.cognitiveservices.azure.com. Do not put any base url as it will build it itself using the resourceName.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8333