SQL Server on Azure VM with TDE via EKM and Azure Key Vault and Managed Identity Key rotation

NS 0 Reputation points
2026-05-04T19:36:41.3866667+00:00

We are using SQL Server on Azure VM with TDE via EKM and Azure Key Vault, authenticated using Managed Identity per the Microsoft documentation.

Microsoft’s SQL Server EKM rotation documentation says SQL Server does not automatically rotate the asymmetric key used for TDE and that manual rotation requires creating a new SQL asymmetric key, creating a login from that asymmetric key, mapping the AKV credential, and altering the database encryption key. However, the MI-based credential appears to require the credential name to match the Key Vault FQDN, for example [vaultname.vault.azure.net], with IDENTITY = 'Managed Identity'.

Questions:

  1. For MI-backed AKV EKM credentials, is the same [vaultname.vault.azure.net] credential expected to be mapped temporarily to both the existing TDE login and the administrator login/new asymmetric-key login during rotation?
  2. Is there a supported MI-specific runbook for rotating to a newer AKV key version for SQL Server on Azure VM?
  3. Is scheduled AKV key-version rotation recommended for SQL Server on Azure VM EKM, given SQL Server does not automatically update the TDE protector, unlike Azure SQL Database/Managed Instance automatic TDE protector rotation?
  4. If the ALTER LOGIN ... ADD CREDENTIAL [vaultname.vault.azure.net] operation fails when the credential is already mapped to the current TDE login, is that expected behavior for MI-backed EKM credentials or a configuration/permission issue?

Moderator: Moved from SQL Server | other.

SQL Server on Azure Virtual Machines

1 answer

Sort by: Oldest
  1. Aditiya Widodo Putra 325 Reputation points
    2026-05-04T22:19:54.5966667+00:00

    Hello @NS, wow, the question you've raised is truly quite complex and touches on advanced security architecture aspects within the Azure ecosystem. I'm answering based on my capabilities and experience in handling mission-critical infrastructure, where the integration between SQL Server, Extensible Key Management (EKM), and Azure Key Vault (AKV) is often a crucial point in data encryption strategies. In the context of Managed Identity (MI), the main challenge indeed lies in the rigid naming of credentials because it must match the FQDN (e.g., [contoso.vault.azure.net]). When you rotate keys, SQL Server still requires credential mapping to perform the "handshake" with AKV. Technically, a single MI credential can be mapped to multiple logins (whether it's the admin login performing the rotation or the new asymmetric login). However, what you need to underline is that SQL Server processes this as an authentication bridge; as long as the Managed Identity on the VM has get, wrapKey, and unwrapKey permissions on the Key Vault, that same single credential can be used simultaneously by various login entities within the SQL instance to access different key versions or new keys during the transition process.

    Regarding the rotation procedure, to date there is no one-click automated runbook provided by Microsoft specifically for MI-based EKM as simple as on Azure SQL Database, because SQL Server on a VM is considered IaaS, giving full control (and full responsibility) to the administrator. The supported rotation process still follows a disciplined manual workflow: you must upload the new key version to AKV, create a new Asymmetric Key inside SQL Server referencing the new key URI (or its specific version), and then use the command ALTER DATABASE ENCRYPTION KEY SET ENCRYPTOR = ASYMMETRIC KEY [NewKeyName]. Regarding scheduled rotation recommendations, although SQL Server does not automatically update the TDE Protector, performing periodic rotation remains a highly recommended security best practice to mitigate the risk of long-term key compromise. You are advised to build an automation script (e.g., via Azure Automation or PowerShell inside the VM) that periodically executes the T-SQL command to ensure the Database Encryption Key (DEK) is always re-encrypted by the latest protector in AKV.

    Finally, addressing the technical obstacle in the ALTER LOGIN ... ADD CREDENTIAL operation, if that operation fails when the credential is already mapped, this is usually not just a permission issue but also a design limitation where SQL Server prevents redundant double mapping or conflicts at the internal metadata level. If the credential [vaultname.vault.azure.net] already exists and is bound to the Managed Identity, you do not need to add it again to a new login if that login can inherit access through the existing credential mapping mechanism. However, if access failure occurs, ensure that the Service Principal of the Managed Identity has been explicitly granted access via Access Policy or RBAC in Azure Key Vault for the new key version. Failures often occur because "Key Permissions" have not been updated on the Azure side after the new key is created, not because of the T-SQL syntax itself. Technically, the key to successful rotation on MI-backed EKM is ensuring that the asymmetric key transition in SQL Server points to the correct AKV key version before you release dependency on the old key.

    That's based on my experience and understanding. Hopefully it's useful and thank you 🙏.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.