PostgreSQL Flexible Server - Recover from deleted Managed Identity (followed documented steps, need validation)

Aizha Akmat 0 Reputation points
2025-10-31T19:23:57.5866667+00:00

Hello ,

We are facing an issue related to managed identity deletion for our Azure Database for PostgreSQL Flexible Server.

As per the documentation:
https://learn.microsoft.com/en-gb/azure/postgresql/flexible-server/security-data-encryption?WT.mc_id=Portal-Microsoft_Azure_OSSDatabases#recovering-from-managed-identity-deletion

We have recreated the managed identity with the same name and reassigned access to the Customer Managed Key in Key Vault.

Because all other configuration options were blocked due to inaccessible state, the only update we could apply to the server was changing the “Locks” setting (as recommended by Azure docs to trigger revalidation).

Please confirm:

  1. Whether the lock update is sufficient to revalidate the new identity.
  2. If any additional action is required to rebind the new managed identity to the CMK key.
  3. How long we should expect the revalidation to take.

Flexible Server: [server name, e.g. ds-stage-postgres-eastus2]

Thank you,

Aizha

Azure Database for PostgreSQL
{count} votes

1 answer

Sort by: Most helpful
  1. Swapnesh Panchal 1,380 Reputation points Microsoft External Staff Moderator
    2025-10-31T21:18:53.1266667+00:00

    Hi Aizha Akmat,
    Welcome to the Microsoft Q&A and thank you for posting your query here.
    When a managed identity used by your PostgreSQL Flexible Server to access the Customer Managed Key (CMK) gets deleted, just recreating the identity with the same name isn’t enough to fix everything.

    You need to update the PostgreSQL server itself to use the new or recovered managed identity explicitly. This means going to the server’s data encryption settings in the Azure portal and selecting the new identity there, then saving the changes.

    Also, make sure the new managed identity has the right permissions on the Key Vault where the CMK is stored. It should at least have the “Key Vault Crypto Service Encryption User” role, which allows it to access the key securely.

    You mentioned updating the server locks, which is one way to trigger the system to re-check and revalidate the identity and key connections. This step is useful and part of the process, but it won’t work unless the new identity is properly linked to the server as mentioned.

    After making those updates, it might take up to an hour for the server to finish validating everything and return to a healthy state where your database is accessible again.

    To be precise:

    • Recreate or recover the managed identity
    • Update the PostgreSQL server configuration to use this new identity
    • Assign correct key permissions in Key Vault to that identity
    • Use the lock update or a server update to trigger revalidation
    • Wait up to 60 minutes for revalidation to complete

    If all these steps are done, the server should come back to a ready state, and your access through the CMK should be restored.

    If still you issue has persisted, please share required details in private message

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    References:

    1 person found this answer helpful.
    0 comments No comments

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.