I'm trying to deploy to Azure from Visual Studio Code and I'm getting the following error:
Failed to deploy agent: Error: Request failed with status code 404: {
"error": {
"code": "UserError",
"severity": null,
"message": "Workspace not found.",
"messageFormat": "Workspace not found.",
"messageParameters": {},
"referenceCode": null,
"detailsUri": null,
"target": null,
"details": [],
"innerError": {
"code": "NotFound",
"innerError": {
"code": "WorkspaceNotFound",
"innerError": null
}
},
"debugInfo": null,
"additionalInfo": null
},
"correlation": {
"operation": "...",
"request": "..."
},
"environment": "eastus",
"location": "eastus",
"time": "2025-05-21T13:48:49.946269+00:00",
"componentName": "rag",
"statusCode": 404
}
I only recently started using Visual Studio Code (use Visual Studio for the most part, but for this Azure Resource, it is not available.) for my current project, and can't seem to figure out how to create a workspace (referenced in error JSON). I did run File -> Save as Workspace..., but I'm still getting the error.
Is there a way to create a compatible workspace for extensions available in VSCode?
Here is the agent YAML:
name: WebBrowseAgent
description: Assistant for browsing web.
model: gpt-4o
instructions: Test
top_p: 0
temperature: 0
tools: []
tool_resources: {}
events: []
inputs: []
outputs: []
system_prompts: {}
response_format: auto
id: <id>
Deploying to Azure from Visual Studio Code
As per the error description, "Workspace not found." was not meant to be Visual Studio Code workspace.
Here it refers to a missing Azure resource, specifically, a workspace in Azure AI Studio. which is required for deploying and managing agents.
Check for Azure AI Studio workspace which you referred to existing in your AI foundry.
If you didn't find any workspace, create one from the link as shown from the screenshot.
Once you fetch the actual name of workspace Update the env variables as mentioned below
AZURE_OPENAI_API_KEY=your-azure-openai-api-key
AZURE_OPENAI_ENDPOINT=https://testvksb.openai.azure.com
AZURE_OPENAI_DEPLOYMENT=gpt-4o
Continue with the rest of the python configuration.
The error appears because the system is trying to deploy the agent definition to an Azure AI workspace and is unable to find it, this is unrelated to VS Code’s concept of workspaces.
Refer: