Azure Database for PostgreSQL: Issues Removing Microsoft Entra Administrator — Dependency and Ownership Challenges

Tobias Runesson 40 Reputation points
2026-11-25T14:08:03.9966667+00:00

Problem description

I am experiencing difficulties removing a Microsoft Entra administrator from my Azure Database for PostgreSQL flexible server. Despite attempting to delete the admin via the Azure Portal, the operation fails due to existing dependencies or privileges still referencing the role.

Environment

Azure Database for PostgreSQL flexible server, West Europe

What I've already tried

I have performed ownership and privilege checks across all affected databases, revoked privileges, and attempted to reassign ownership. I also ran dependency queries and role membership checks. Additionally, I ensured the public schema ownership is correct and tried to revoke privileges accordingly.

Current status

I am seeking guidance on how to identify and remove remaining dependencies or privileges that block the deletion of the Entra administrator role, and whether manual modifications are supported in this scenario.

Azure Database for PostgreSQL
0 comments No comments

1 answer

Sort by: Most helpful
  1. SHOUMIK CHAKRAVARTY 1,710 Reputation points
    2026-11-28T21:39:03.1533333+00:00

    Hi @Tobias Runesson -

    Taking your questions in order.

    Identifying what is blocking it

    PostgreSQL will usually tell you. From Dropping Roles:

    "If DROP ROLE is attempted while dependent objects still remain, it will issue messages identifying which objects need to be reassigned or dropped."

    So instead of trying to infer dependencies from catalog queries, reproduce the failure in psql and read the error. PostgreSQL will often tell you exactly what is still blocking the role from being removed.

    Removing the remaining dependencies

    The part that usually catches is that REASSIGN OWNED by itself is often not enough.

    From the same PostgreSQL documentation:

    "DROP OWNED also takes care of removing any privileges granted to the target role for objects that do not belong to it. Because REASSIGN OWNED does not touch such objects, it's typically necessary to run both REASSIGN OWNED and DROP OWNED (in that order!)"

    The same page also notes that neither command reaches into other databases, so both need to be run in each one:

    -- Run in each database where the role may own objects or hold privileges
    REASSIGN OWNED BY "entra_admin_role" TO "replacement_role";
    DROP OWNED BY "entra_admin_role";
    

    Once that has been done everywhere, including the postgres database, retry the administrator removal.

    If a subsequent DROP ROLE still fails, PostgreSQL should identify the remaining dependency.

    Whether manual cleanup is supported

    The closest the docs come is in Microsoft Entra authentication in Azure Database for PostgreSQL flexible server, under Limitations and considerations:

    "If you delete a Microsoft Entra principal from Microsoft Entra ID, the principal remains as a PostgreSQL role... Database administrators need to transfer ownership and drop roles manually."

    That describes a different scenario, so I would not treat it as direct guidance for removing an Entra administrator. What it does show is that manually transferring ownership and cleaning up PostgreSQL roles is expected practice on this service rather than something unsupported.

    Help make this community better for everyone: if this answer resolved your issue, please accept it or leave an upvote. If not, share more details in a comment so we can continue the discussion and find the right solution.

    Was 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.