Private connectivity and Entra identity for a bank's database estate
A bank has one Azure SQL Database (General Purpose, 8 vCores) for a customer portal and one SQL Managed Instance for a legacy lending system, both in West Europe. Group policy requires that no database be reachable from the internet. The portal runs on AKS in the same region and authenticates with a workload identity; developers currently embed a SQL login and password in a Kubernetes secret. Twelve analysts query the SQL Database from Power BI Desktop on corporate laptops connected by VPN. Compliance requires seven years of immutable audit logs and customer-managed keys for encryption at rest. The on-premises DNS servers forward only to public resolvers.
1. Design the network path for the AKS pods and for the analysts. What will break first, and how do you fix it?
Read the worked answer
The two services need different mechanisms:
- Azure SQL Database: create a private endpoint in the VNet where the AKS nodes run and link a private DNS zone named
privatelink.database.windows.netto that VNet. Only then set the logical server's public network access to Deny - doing it first breaks the deployment. - Managed Instance: it is already VNet-injected, so there is no private endpoint to create. Peer the hub VNet to the instance's VNet and confirm NSG rules allow 1433 and 3342.
What breaks first is name resolution, not connectivity. The pods and the analysts' laptops will keep resolving the public gateway name and the connection will be refused or routed to a blocked public endpoint. Fixes:
- AKS: the cluster's DNS must forward the
privatelink.database.windows.netzone to Azure (168.63.129.16) or to a DNS Private Resolver inbound endpoint. - Analysts on VPN: the corporate DNS forwards only to public resolvers, so add conditional forwarders for the privatelink zone to the resolver's inbound endpoint.
Verify from a pod and from a laptop that nslookup returns the 10.x private address. Until it does, treat connectivity as unproven.
2. Replace the embedded SQL credential. What must exist before it works, and how do you avoid over-privileging?
Read the worked answer
Give the AKS workload a user-assigned managed identity federated to the Kubernetes service account, then create a contained user in the database:
CREATE USER [mi-portal] FROM EXTERNAL PROVIDER;
ALTER ROLE db_datareader ADD MEMBER [mi-portal];
ALTER ROLE db_datawriter ADD MEMBER [mi-portal];
GRANT EXECUTE ON SCHEMA::dbo TO [mi-portal];
Prerequisites that fail silently if missed: a Microsoft Entra admin must be set on the logical server, the identity must live in the same tenant, and the connection string must change to Authentication=Active Directory Managed Identity;User Id=<client-id>.
Avoid over-privileging: do not add db_owner because the deployment "needs it" - grant a custom role for the specific DDL the app performs. Delete the Kubernetes secret and its history afterward.
For the Managed Instance, the same identity can be a server-level Entra login (CREATE LOGIN ... FROM EXTERNAL PROVIDER), which Azure SQL Database does not support. That matters if the lending app uses cross-database queries; contained users alone will not cover them.
3. Configure encryption and auditing to satisfy the two compliance items. What operational risks do you accept?
Read the worked answer
Customer-managed keys for TDE: create the key vault with soft delete and purge protection enabled first - Azure SQL refuses a vault without them, because deleting the key would render the database unrecoverable. Use an RSA 2048/3072/4096 key, and grant the server's and the instance's system-assigned managed identity get, wrapKey, unwrapKey (Key Vault RBAC role Key Vault Crypto Service Encryption User).
Accepted risks to document: if the key is disabled, deleted, or the vault firewall blocks the SQL service, the database goes offline. Keep the "allow trusted Microsoft services" bypass on, and rehearse key rotation.
Auditing: enable it at server and instance level so it covers every database including future ones, writing to a storage account configured with immutable blob storage using a time-based retention policy of at least 7 years (legal hold is the alternative). A mutable container fails the requirement even though the audit records are there.
Add Log Analytics as a second sink only if you need alerting on failed logins; the immutable storage account is the compliance record and should not be the alerting path.