AI-102 Implement an agentic solution Practice Question
A developer is building an agent using the Microsoft Bot Framework SDK in C#. The agent must authenticate users via Microsoft Entra ID and maintain state across conversations. The solution must store user preferences (e.g., language, timezone) in Azure Cosmos DB. Which state management approach should the developer use?
⚠ Common exam trap
A common mix-up: candidates confuse UserState (persistent across conversations) with ConversationState (temporary per conversation), leading candidates to incorrectly choose ConversationState with Memory Storage, which loses data when the bot restarts.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use UserState with Cosmos DB Storage.
The developer needs to persist user preferences across conversations, which requires UserState (not ConversationState, which is scoped to a single conversation). Cosmos DB Storage is the appropriate choice for durable, scalable, and low-latency storage of user-specific data, and it integrates directly with the Bot Framework SDK's `CosmosDbPartitionedStorage` class.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use the Bot State Service (deprecated).
Why it's wrong here
The Bot State Service is retired and cannot write to Azure Cosmos DB, so it fails the stated persistence requirement outright. It is tempting as the historical default for bot state, and would have been correct in legacy SDK versions before the deprecation.
- ✗
Use UserState with Blob Storage.
Why it's wrong here
Blob Storage cannot serve as the state store here because the requirement names Azure Cosmos DB for user preferences. Blob-backed UserState suits low-cost, eventually consistent persistence of simple serialised data, not the specified Cosmos DB container.
- ✗
Use ConversationState with Memory Storage.
Why it's wrong here
Memory Storage keeps state in process RAM, so it neither persists across restarts nor writes to Azure Cosmos DB as required. It is tempting for local debugging where state loss between runs is acceptable, but production conversation state needs a durable store.
- ✓
Use UserState with Cosmos DB Storage.
Why this is correct
UserState scopes data per user across conversations, and Cosmos DB Storage persists it durably, satisfying both the Entra ID authentication and cross-conversation preference requirements. ConversationState alone would lose language and timezone settings once the session ends.
Go deeper
Related to this question
About these practice questions
One of 761 original AI-102 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AI-102 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AI-102 exam.