azure-cli-extensions icon indicating copy to clipboard operation
azure-cli-extensions copied to clipboard

Unable to connect to Postgres flexible server - Database dump & restore using az-cli

Open azeem2020 opened this issue 2 years ago • 8 comments

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

azeem2020 avatar Jun 20 '22 10:06 azeem2020

Thank you for your feedback. This has been routed to the support team for assistance.

ghost avatar Jun 20 '22 11:06 ghost

route to CXP team

yonzhan avatar Jun 20 '22 11:06 yonzhan

@azeem2020 Thank you for reaching out we are looking into it.

RakeshMohanMSFT avatar Jun 21 '22 08:06 RakeshMohanMSFT

@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

RakeshMohanMSFT avatar Jun 21 '22 08:06 RakeshMohanMSFT

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 avatar Jun 24 '22 09:06 azeem2020

@azeem2020 Glad to know that the provided solution helped, I am not sure I quite understand your question, can you please elaborate?

RakeshMohanMSFT avatar Jun 24 '22 10:06 RakeshMohanMSFT

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?

azeem2020 avatar Jun 24 '22 13:06 azeem2020

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:

question, customer-reported, PostgreSQL, Service Attention, needs-team-attention

Milestone: -

ghost avatar Jun 29 '22 02:06 ghost

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.

teo113 avatar Aug 30 '22 10:08 teo113

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

jorgelaranjo avatar Dec 09 '22 11:12 jorgelaranjo