{
  "id": 22615296,
  "title": "Foundry Agent Webapps: Cosmos or Azure SQL for Backend State, and When?",
  "url": "https://urgent.news/2026/11/29/foundry-agent-webapps-cosmos-or-azure-sql-for-backend-state-and-when",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-29T16:34:12.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/geekindata/foundry-agent-webapps-cosmos-or-azure-sql-for-backend-state-and-when-kj1"
  },
  "original_language": null,
  "account": "Foundry agent web applications require careful consideration when deciding between Cosmos DB and Azure SQL for managing backend state. To avoid confusion, it is essential to split app-owned backend state from the Foundry platform stores before arguing about Cosmos versus Azure SQL. This separation allows for a clearer understanding of which engine best suits the specific needs of the app-owned collections.\n\nWhen choosing between Cosmos and Azure SQL, consider the nature of the payload and the required relational operations. Cosmos DB is preferred when dealing with flexible document bags and scenarios where little relational joining is necessary. On the other hand, Azure SQL with Entity Framework Core is recommended when app-owned records must join cleanly and support relational operations, such as constraints and migrations.\n\nOne key aspect to keep in mind is that the API routes and JSON shapes for every app-owned collection must remain frozen. This ensures that the shell and callers do not need to relearn the contract during a migration. Once the migration is complete, the Cosmos app-data path can be deleted.\n\nThe decision to migrate from Cosmos to Azure SQL should be based on the specific requirements of the product. If joins, constraints, and migrations as code are crucial, Azure SQL is the better choice. It provides a stable HTTP API and supports queries that look like SQL, making it easier for support and audit teams to work with the data.\n\nIt is essential to understand that the decision about which engine backs the app-owned plane behind one product API is not a universal mandate. The shell API should remain stable, while the store engine can change. This means that sample defaults, such as the default use of Cosmos in Microsoft RAG chatbot samples, should be treated as context rather than a definitive rule. The real decision lies in which engine best supports the app-owned collections and meets the specific requirements of the product.",
  "summary": "I used AI tools to help draft and edit this post. I checked the facts and the wording, and the original lives at geekindata.com . The diagrams are on that page. Two store planes; one product API Key takeaways Split app-owned backend state from Foundry platform stores before you argue Cosmos versus Azure SQL. Sample RAG and chat diagrams often default history to Cosmos; treat that as tutorial…",
  "summary_source": "publisher",
  "key_points": [
    "Split app-owned backend state from Foundry platform stores before comparing Cosmos and Azure SQL.",
    "Freeze API routes and JSON shapes for app-owned collections to ensure stable migration."
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}