Courseiva
Develop Azure compute solutionshardMultiple ChoiceObjective-mapped

AZ-204 Develop Azure compute solutions Practice Question

Your company is migrating a legacy on-premises .NET Framework 4.7.2 web application to Azure. The application uses session state stored in-memory and reads/writes to a local SQL Server database. The migration must minimize code changes, support auto-scaling, and handle session state across multiple instances. You plan to use Azure App Service with Windows OS. You need to recommend a solution for session state storage and database connectivity. Which option should you choose?

⚠ Common exam trap

Many exam-takers confuse ARR affinity with a valid session state solution, not realizing that it prevents horizontal scaling by forcing requests to a single instance, which contradicts the auto-scaling requirement.

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 Azure Cache for Redis as the session state provider via the RedisSessionStateProvider NuGet package, and configure the database connection string in Azure App Service App Settings.

Azure Cache for Redis provides a distributed, in-memory session state provider that supports session state sharing across multiple App Service instances without requiring code changes to the application logic. The RedisSessionStateProvider NuGet package is a drop-in replacement for the default in-memory provider, and configuring the database connection string in App Settings allows you to change the target without modifying web.config, minimizing migration effort.

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 Azure Cache for Redis as the session state provider via the RedisSessionStateProvider NuGet package, and configure the database connection string in Azure App Service App Settings.

    Why this is correct

    Azure Cache for Redis provides a highly performant, scalable, and distributed cache solution ideal for managing session state in cloud environments. The `RedisSessionStateProvider` NuGet package integrates seamlessly with existing ASP.NET applications, requiring minimal code changes to leverage this robust backend. Configuring the connection string in Azure App Service App Settings ensures secure management, easy updates without redeploying, and supports auto-scaling effectively by centralizing session data.

  • Store session state in Azure Table Storage using a custom session state provider, and use a connection string for Azure SQL Database.

    Why it's wrong here

    Storing session state in Azure Table Storage using a custom provider is highly inefficient and complex for typical session state requirements. Implementing a custom provider demands significant development effort and ongoing maintenance, deviating from optimized, off-the-shelf solutions. Azure Table Storage is optimized for large-scale, non-relational data, not for the frequent, low-latency reads and writes typical of session state, and specifying an Azure SQL Database connection string is a fundamental misconfiguration for Table Storage.

  • Configure session state using Azure SQL Database with a session state database, and update the connection string in web.config.

    Why it's wrong here

    Using Azure SQL Database for session state, while technically possible with the `SqlSessionStateProvider`, introduces significant performance overhead and scalability challenges. A relational database is not optimized for the high-frequency, transient key-value operations characteristic of session state, potentially becoming a bottleneck for auto-scaling. Updating the connection string directly in `web.config` is also a less flexible and less secure practice for cloud deployments compared to utilizing Azure App Service App Settings.

  • Use App Service's built-in session state with ARR affinity and connect to Azure SQL Database using Managed Identity.

    Why it's wrong here

    App Service's built-in session state with ARR affinity is fundamentally incompatible with scalable cloud architectures. ARR affinity 'sticks' user requests to a specific web server instance, preventing horizontal scaling and instance replacement, which defeats the purpose of auto-scaling and high availability. While using Managed Identity for database connections is a secure best practice, it does not mitigate the severe limitations imposed by ARR affinity on session state management.

About these practice questions

One of 881 original AZ-204 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 →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-204 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 AZ-204 exam.