An Azure managed PostgreSQL database service for app development and deployment.
"An unexpected error occurred while trying to validate user" while creating role in PostgreSQL Single Server with a service account
I'm trying to write a batch that will synchronize Azure Postgresql users with an external source. The batch fails when calling:
create role "${username}" with login in role azure_ad_user
The error is :
An unexpected error occurred while trying to validate user.
Everything works if I use my own personal account. It only fails when I try to use a service account.
The service account is a member of the AAD Admin group and has been granted the "Directory.Read.All" permission.
The service account is able to drop users so it clearly has admin rights. I can confirm that the token contains the object id of the AAD Admin group.
I've tried with :
SET aad_validate_oids_in_tenant = off;
But it doesn't work.
Any help is appreciated !
Thank you