-
Notifications
You must be signed in to change notification settings - Fork 236
Issue connection on Azure with passwordless authentication #423
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
Comments
Hi @WilliamB17 I ran into this issue today and found your post - so thought I'd share what I found (in case you haven't solved this yet - and for anybody else who finds this): Our problem was that we were using user-assigned managed identities (UAMI) and the provider doesn't allow you to specify a UUID of an a UAMI, so therefore this call signs is as a system assigned managed identity. As a workaround you can set the In the long term, could probably add a configuration parameter to the provider |
hey , has anyone successfully implemented authentication with managed identities ? |
I solved this issue by basically using the solution from here. Since I am using terragrunt I was able to do the following: # terragrunt.hcl
inputs = {
...
db_username = <MY USERNAME>
db_password = run_cmd("--terragrunt-quiet", "az account get-access-token --resource-type oss-rdbms | jq -r .accessToken")
}
# provider.tf
provider "postgresql" {
host = var.server_endpoint
port = var.server_port
database = var.root_db
username = var.db_username
password = var.db_password
superuser = false
sslmode = "require"
} Attempting to do this via terraform alone was not trivial, as the data, local-exec and null resources all were providing the output only on apply. I think a proper solution for this issue would be to allow specifying the azure auth credentials as part of the provider so that the token can be obtained appropriately. But since I was able to resolve my issue using terragrunt alone, I would not be spending time to resolve this "properly". |
Hi,
I get an error when I try to connect to my database via passwordless authentication:
Error: Error connecting to PostgreSQL server psql-000.postgres.database.azure.com (scheme: postgres): pq: Service Principal oid mismatch for role[my_administrator_principal_name].
I use the latest provider version 1.22.0 and Terraform v1.7.5
However, I manage to connect with psql as described here : https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/how-to-configure-sign-in-azure-ad-authentication
The text was updated successfully, but these errors were encountered: