You are configuring a C# ASP.NET Core web application hosted in Azure App Service to connect to a Premium tier Azure Cache for Redis instance. To align with security best practices, you must eliminate the use of access keys and implement Microsoft Entra ID authentication using the system-assigned managed identity of the App Service.
Which sequence of steps should you perform to configure and establish this secure connection?
- 1Enable Microsoft Entra ID authentication on the Azure Cache for Redis instance.
- 2Create a Redis Access Policy assignment that associates the App Service's managed identity with a Redis Access Policy.
- 3In the web application, use the Azure Identity client library to acquire a Microsoft Entra ID access token for the Redis resource.
- 4Configure the StackExchange.Redis configuration options by setting the username to the Object ID of the managed identity and the password to the acquired token.
- 5Call ConnectionMultiplexer.Connect using the configured options to establish the connection.
Cevap
To configure Microsoft Entra ID authentication using the system-assigned managed identity, first enable Microsoft Entra ID authentication on the Azure Cache for Redis instance. Second, assign a Redis Access Policy to the managed identity. Third, in the application code, acquire a Microsoft Entra ID token. Fourth, configure the StackExchange.Redis connection options using the Object ID of the managed identity as the username and the token as the password. Finally, establish the connection using the ConnectionMultiplexer.
Establishing a passwordless connection requires enabling Entra ID authentication on the Redis resource, configuring the appropriate Redis Access Policy for the managed identity, obtaining the JWT access token client-side, configuring the client to pass the Object ID and token, and finally establishing the connection.
Adım Adım Çözüm
Anahtar Kavram
Microsoft Entra ID Authentication and Access Policies in Azure Cache for Redis
Tahmini Süre:2m 0s