You are developing a C# desktop application that will run on employee workstations. The application needs to retrieve user-specific records from an Azure SQL Database. You want to authenticate users via the Microsoft Identity Platform and access the database using the signed-in user's identity. Which authentication configuration should you implement?
- AEnable a system-assigned managed identity for the desktop application within Microsoft Entra ID and use the DefaultAzureCredential class to retrieve the token.
- BCreate a system-assigned managed identity for the Azure SQL Database and store its client secret in the application configuration file.
- Register the application as a public client in Microsoft Entra ID and use the Microsoft Authentication Library (MSAL.NET) to acquire a token using interactive authentication.Cevap
- DGenerate a Shared Access Signature token with full read and write permissions and embed it directly in the client application source code.
Cevap
Register the application as a public client in Microsoft Entra ID and use the Microsoft Authentication Library (MSAL.NET) to acquire a token using interactive authentication.
The correct answer correctly identifies that a desktop application running on local employee workstations is classified as a public client because it cannot keep application secrets confidential. Registering it as a public client and utilizing MSAL.NET to acquire a token interactively allows the app to authenticate the user and obtain a security token for Azure SQL Database under the user's active context.
Adım Adım Çözüm
Anahtar Kavram
Public client authentication with MSAL.NET