You are implementing distributed session management for a horizontally scaled ASP.NET Core app using Azure Cache for Redis. After deployment, some users are getting logged out unexpectedly between requests. What is the most likely cause?

Direct Answer (Verified)Reviewed by Sunny (Senior Cloud Engineer)

Correct Answer: Data Protection keys are not shared across instances, causing session decryption to fail on different instances

ASP.NET Core encrypts session data using Data Protection keys. When multiple app instances each have their own keys, a session written by Instance A cannot be decrypted by Instance...

๐Ÿ“‹Part of Microsoft Certified: Azure Developer Associate (AZ-204) ยท Azure Certification Practice
Real Exam ScenarioAzure Cache for Redis

You are implementing distributed session management for a horizontally scaled ASP.NET Core app using Azure Cache for Redis. After deployment, some users are getting logged out unexpectedly between requests. What is the most likely cause?

โœ“ Correct Answer & ExplanationAzure Cache for Redis

Correct Answer

Data Protection keys are not shared across instances, causing session decryption to fail on different instances

Why This Answer Is Correct

ASP.NET Core encrypts session data using Data Protection keys. When multiple app instances each have their own keys, a session written by Instance A cannot be decrypted by Instance B. The fix is to configure Data Protection to persist keys to a shared store (e.g., Azure Blob Storage) so all instances share the same keys.

๐Ÿ“š What This Question Tests

This question evaluates your knowledge of Azure Cache for Redis โ€” a core concept tested in Microsoft Certified: Azure Developer Associate (AZ-204). Understanding Azure Cache for Redis is essential for designing scalable, secure, and cost-effective cloud architectures. Mastery of this topic will help you answer scenario-based questions confidently on exam day.