azure-cli-extensions
azure-cli-extensions copied to clipboard
Unable to connect to Postgres flexible server - Database dump & restore using az-cli
Bug/Error
Command Name
az postgres flexible-server connect Extension Name: rdbms-connect. Version: 1.0.2.
Errors:
Unable to connect to flexible server: could not translate host name "pgxxxx-001.postgres.database.azure.com" to address: Unknown host
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here...
-
az postgres flexible-server connect -n {} -u {} -d {} -p {}
Expected Behavior
The connection using CLI is essential so we can continue with dump & restore to Azure Storage. For Single Server, below is the guide and same behavior expecting for Azure PostgreSQL Flexible Server.
https://docs.microsoft.com/en-us/azure/postgresql/migrate/how-to-migrate-using-dump-and-restore
Azure PostgreSQL Flexible Server Resource Overview
**Network connectivity:**
Connectivity method: Private access (VNet Integration)
**Connection Source:**
Corporate Network
**Destination:**
PostgreSQL Flexible Server (Private IP)
Environment Summary
Windows-10-10.0.19043-SP0
Python 3.10.4
Installer: MSI
azure-cli 2.37.0
Extensions:
rdbms-connect 1.0.2
Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1
Additional Context
Thank you for your feedback. This has been routed to the support team for assistance.
route to CXP team
@azeem2020 Thank you for reaching out we are looking into it.
@azeem2020 can you please go through these articles once? https://stackoverflow.com/questions/67982207/why-cant-i-connect-to-azure-postgresql-flexible-using-hostname and https://docs.microsoft.com/en-us/azure/dns/private-dns-overview
The workaround works fine. Thank you for the articles, We would like to rollout this change globally within Organizations instead to update individual's host file?
@azeem2020 Glad to know that the provided solution helped, I am not sure I quite understand your question, can you please elaborate?
The given solution in article is to update Desktop/PC's Host file entries with PostgreSQL FQDN and Private IP address.
There are number of developers who will access the DB server(s) and instead to update individual's PC host file for each server, we want to make entry in organization's DNS server against private IP. What are the possibilities to make that change globally?
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @sunilagarwal, @lfittl-msft, @sr-msft, @niklarin.
Issue Details
Bug/Error
Command Name
az postgres flexible-server connect Extension Name: rdbms-connect. Version: 1.0.2.
Errors:
Unable to connect to flexible server: could not translate host name "pgxxxx-001.postgres.database.azure.com" to address: Unknown host
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here...
-
az postgres flexible-server connect -n {} -u {} -d {} -p {}
Expected Behavior
The connection using CLI is essential so we can continue with dump & restore to Azure Storage. For Single Server, below is the guide and same behavior expecting for Azure PostgreSQL Flexible Server.
https://docs.microsoft.com/en-us/azure/postgresql/migrate/how-to-migrate-using-dump-and-restore
Azure PostgreSQL Flexible Server Resource Overview
**Network connectivity:**
Connectivity method: Private access (VNet Integration)
**Connection Source:**
Corporate Network
**Destination:**
PostgreSQL Flexible Server (Private IP)
Environment Summary
Windows-10-10.0.19043-SP0
Python 3.10.4
Installer: MSI
azure-cli 2.37.0
Extensions:
rdbms-connect 1.0.2
Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1
Additional Context
Author: | azeem2020 |
---|---|
Assignees: | RakeshMohanMSFT |
Labels: |
|
Milestone: | - |
Also having this issue with host name not being recognised. I'm connecting from within our corporate VPN, to a PostrgeSQL flexible server (name.postgres.database.azure.com) created in an existing VNet & subnet, with a new private DNS zone (name.private.postgres.database.azure.com). Can we have an update on this issue? Access to Azure from our network has been configured on the on-prem firewall and the Azure firewall.
Use the name without postgres.database.azure.com
eg if your DB Is my-db.postgres.database.azure.com
enter
az postgres flexible-server connect --name=my-db