Hello Rodrigo Maldonado,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that you cannot store completions in Azure Foundry.
This isn’t a bug. Azure AI Foundry and Azure OpenAI never persist completions automatically, so the root cause is simply the absence of a storage architecture.
What you will need to do are the following:
- You must explicitly capture the model’s response in code: ``` response = client.chat.completions.create(model="gpt-4o", messages=messages)
thenoutput_text = response.choices[0].message.content` ``.
- Choose a persistent store matching your pattern: Azure Blob Storage for raw logs, Azure Cosmos DB for conversation history, or Azure SQL Database for structured apps.
- Insert the captured output into Cosmos DB:
container.create_item({"id": str(uuid.uuid4()), "user_id": user_id, "prompt": messages, "response": output_text, "timestamp": datetime.utcnow().isoformat()}).
- Add observability with Azure Monitor Application Insights to track latency, token usage, and failures. See the link here - https://learn.microsoft.com/azure/azure-monitor/app/app-insights-overview.
- If you use Azure AI Foundry, Prompt Flow provides built‑in execution tracking and lineage but does not replace long‑term storage - https://learn.microsoft.com/azure/ai-studio/how-to/prompt-flow.
- For multi‑turn experiences, implement conversation memory by storing structured message arrays such as
{"session_id":"abc123","messages":[{"role":"user","content":"..."},{"role":"assistant","content":"..."}]}.
- Finally, lock data down with Azure’s default encryption at rest, mask sensitive fields, and apply RBAC – refer to the encryption fundamentals- https://learn.microsoft.com/azure/security/fundamentals/encryption-atrest.
I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.