Unable to connect to PostgreSQL as B2B, Guest, with Azure Data Studio

173 Views Asked by At

In this answer, https://stackoverflow.com/a/67866160/20665333, it is mentioned that the User name format when connecting to PostgreSQL with Azure Data Connect and using Azure Active Directory Authentication type is UPN@PostgreSQLServerName.

But when I try to connect using a B2B, Guest user I don't seem to get it to work.

Is it in fact impossible to use B2B, Guest accounts to make this PostgreSQL Connection in Azure Data Studio? ... or am I missing something else in this type of setup?

The server is an Azure Database for PostgreSQL flexible server and the user I try to connect as, is a member of the Azure Active Directory Administrators (Azure AD Admins) group defined in Azure.

I can successfully use the Connection - Browse, to find the Tenant and the PostgreSQL database server I want to connect to. I then try all kind of User name combinations, but they all give me the error...

connection failed: FATAL: password authentication failed for user "xxx@PostgreSQLServer"

I am able to use the same B2B identity to connect to Azure SQL databases in the same tenant with Azure Data Studio, but when I select the Azure SQL, the Authentication Type changes to "Azure Active Directory - Universal with MFA support", indicating that modern auth is not fully supported when I try to connect to PostgreSQL in Azure.

1

There are 1 best solutions below

0
Kent Nordström On

It looks like I found the problem myself...

When connecting as being part of an Azure AD Group, the User name in the Connection should be the name of the Group, for example "SQL Admins for Postgre"

PostgreSQL Connection in Azure Data Studio when connecting as member of a Group