BrianM
BrianM

Reputation: 866

Get Azure access token for PostgreSQL with username and password

Using the az cli, I can get an access token with the following commands

az login --username <email address> --password <my password>
az account get-access-token --resource https://ossrdbms-aad.database.windows.net

I understand that this is not recommended (using the username and password), but sometimes it's a reality. My question is, how do I replicate this functionality in .NET? The only option I see is the UsernamePasswordCredential.

https://learn.microsoft.com/en-us/dotnet/api/azure.identity.usernamepasswordcredential?view=azure-dotnet

But that requires the client ID of an App Registration. The az cli does not require that. I just want to have the user specify the username and password and have it retrieve a token. Any help would be greatly appreciated.

Upvotes: 0

Views: 38

Answers (1)

juunas
juunas

Reputation: 58863

I'm pretty sure AZ CLI uses its own client ID for the request.

The endpoint in Entra ID requires a client ID.

Upvotes: 0

Related Questions