Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] psql cli on web fails when FSPG with AAD is used #440

Open
srdjanrilak-ms opened this issue Jun 21, 2024 · 3 comments
Open

[BUG] psql cli on web fails when FSPG with AAD is used #440

srdjanrilak-ms opened this issue Jun 21, 2024 · 3 comments
Labels
bug Something isn't working Priority 1 Size: Medium 3 days - 1 week of work

Comments

@srdjanrilak-ms
Copy link

To Reproduce

If one creates an instance of PostgreSQL service (FSPG) with AAD enabled and tries to connect to it on Portal using bash as a shell and AAD login, the console will show an error and psql will not be connected.

It looks like the bash command for psql does not use escape characters correctly.

The generated command fails, but if I run very similar one with different escaping, it works. Screenshot shows the command that fails. The one that works is following psql "host=entera-test-2.postgres.database.azure.com port=5432 dbname=postgres user=srdjanrilak@microsoft.com password='$(az account get-access-token --resource-type oss-rdbms --output tsv --query accessToken)' sslmode=require"

image

Observed Behavior

Already described in the previous section.

Expected behavior

The psql tool should be connected to the database on the startup.

Is this specific to Cloud Shell?

Running the correct command outside the cloud shell works fine.

Interface information

I access cloud shell with Edge browser on Windows Server 2022. Used bash on web.

@srdjanrilak-ms srdjanrilak-ms added bug Something isn't working Triage-needed Triage needed by Cloud Shell team labels Jun 21, 2024
@mbifeld mbifeld added Priority 1 Size: Medium 3 days - 1 week of work and removed Triage-needed Triage needed by Cloud Shell team labels Jul 9, 2024
@mbifeld
Copy link
Member

mbifeld commented Jul 9, 2024

@surajssd Could this be connected to the mysql installing the server version rather than client version? Unlikely but surprised we're not seeing issues for escape characters not working outside of psql

@surajssd
Copy link
Member

So this issue was before we removed the mysql package.

Also I think this can be broken down into two steps to see if it works:

export PS_PASS="$(az account get-access-token --resource-type oss-rdbms --output tsv --query accessToken)"
psql "host=entera-test-2.postgres.database.azure.com port=5432 dbname=postgres user=srdjanrilak@microsoft.com password=${PS_PASS} sslmode=require"

My hunch is that the sub-query which gets password is not being evaluated but is getting interpreted as a string.

@mbifeld
Copy link
Member

mbifeld commented Aug 13, 2024

@srdjanrilak-ms has the above recommendation worked for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority 1 Size: Medium 3 days - 1 week of work
Projects
None yet
Development

No branches or pull requests

3 participants