You are designing the security architecture for a C# web application deployed to two distinct Azure App Service instances in different regions (East US and West US) to support active-active high availability. Both App Service instances must retrieve database connection strings from a shared Azure Key Vault and connect to a shared Azure SQL Database without storing credentials in code or configuration files.
The design must satisfy the following security and operational constraints:
- Minimize administrative overhead by avoiding the creation of separate database users and Key Vault access policies/RBAC roles for each regional App Service instance.
- Ensure that if one of the App Service instances is deleted, the identity used to authenticate to the Key Vault and Azure SQL Database remains intact and functional for the remaining instance.
- The application code must use the C# Azure.Identity SDK and instantiate DefaultAzureCredential to authenticate to both services.
Which configuration and code setup should you implement to meet these requirements?
- ACreate a system-assigned managed identity for each App Service instance by setting the identity.type property to SystemAssigned in the ARM templates. Grant each identity Key Vault and Azure SQL Database access. If one App Service instance is deleted, use the Azure CLI command az identity restore to recover the deleted security principal.
- Create one user-assigned managed identity. In the App Service ARM templates, set the identity.type property to UserAssigned and configure the identity's resource ID in the userAssignedIdentities property. Configure the AZURE_CLIENT_ID application setting on both App Services with the client ID of the user-assigned managed identity, and instantiate DefaultAzureCredential in C# code.Cevap
- CCreate one user-assigned managed identity and assign it to both App Service instances. In the C# application code, instantiate DefaultAzureCredential without setting any configuration parameters or environment variables, allowing the SDK to automatically discover the assigned identity.
- DCreate a single user-assigned managed identity. In the App Service ARM templates, set the identity.type property to SystemAssigned and reference the user-assigned identity's principal ID. Grant the Key Vault access policies to the general Azure App Service resource provider service principal.