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

Lab 10: Connect to source issue #11

Closed
afelix-95 opened this issue May 3, 2024 · 7 comments
Closed

Lab 10: Connect to source issue #11

afelix-95 opened this issue May 3, 2024 · 7 comments

Comments

@afelix-95
Copy link
Contributor

Module: 00

Lab/Demo: 10

Task: Create Database Migration Project in Azure Database for PostgreSQL Flexible Server

Step: 04

Description of issue

After importing the users and roles from the local server to the flexible server, I could not connect to source when creating the Migration project in the Azure Portal. I tried using both the postgres superuser and the pgadmin user created without a superuser role but both options return an error Failed to connect to server : Authentication failed. The provided password is incorrect. Please confirm it and try again. I've triple checked the passwords and they both work when connecting locally to the database, so I'm sure they're correctly typed in the configuration step.

Repro steps:

Screenshot 2024-05-03 132149

@HeyMo0sh
Copy link
Contributor

HeyMo0sh commented May 6, 2024

If you are doing it with Azure VM then the public network NSG needs to be set up.
Have you setup the local postgresql instance to be configured to listen for hosts which are not local?

If those work for you then I will write that up - the password not correct when it is says to me that there is something blocking communication from Migrate PostgreSQL to Azure Database for PostgreSQL Flexible Server

@HeyMo0sh
Copy link
Contributor

HeyMo0sh commented May 6, 2024

You have localhost as the server name. The source server has to be accessible to the flexible server, i.e. it has to be accessible from the internet.

So you have to allow your IP address and port 5432 open. Azure won't be able to resolve localhost.
I will document this.

@afelix-95
Copy link
Contributor Author

I am testing it outside of VM environment.
I checked the postgresql.conf file and its parameter listen_addresses was already set to '*'.
In the pg_hba.conf file, I added the following line:

host    all    all    0.0.0.0/0    md5

I have also added Firewall rules for port 5432.
After that, I restarted the server and tried connecting to it again using the server's public IP address instead of localhost.
Now the error that I'm getting is:

Failed to connect to server : The operation has timed out.

@HeyMo0sh
Copy link
Contributor

HeyMo0sh commented May 7, 2024

Are you able to connect to your database from say another Azure VM? you can either telnet to 5432 or using powershell:

Test-NetConnection -ComputerName -Port 5432 -InformationLevel "Detailed"

I found I had to set up a NSG for port 5432 on the VM and also do windows firewall on the VM itself

@afelix-95
Copy link
Contributor Author

Having the "local" database in an Azure VM works, so there is probably some additional network setting in my work computer that I need to change before establishing any connections to it through the internet. I reproduced all the configuration steps in both environments but it works only in the VM. I guess we can consider it an edge case and close the issue.

@afelix-95
Copy link
Contributor Author

One more thing, in the instructions for Create Database Migration Project in Azure Database for PostgreSQL Flexible Server, step 5 you reference user as demo and its password as Pa$$w0rd for the target server but in this case it should be pgAdmin and the random password generated at the beginning of the lab instructions.

@HeyMo0sh
Copy link
Contributor

HeyMo0sh commented May 7, 2024

Thanks for spotting that - I have corrected it and pushed to #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants