@Abhishek Patil Thanks for reaching out.
You need to Ensure that your PostgreSQL database is accessible from the internet. You need to ensure that your PostgreSQL database is accessible from the internet by configuring your router to forward incoming traffic on the PostgreSQL port (default port is 5432) to your laptop's IP address. Make sure to have the static IP as if you have dynamic IP then the connection IP would be changed every time.
Once you have verified the above step then you need to Configure your PostgreSQL database to allow incoming connections: You need to configure your PostgreSQL database to allow incoming connections from the internet. You can do this by modifying the pg_hba.conf file to allow incoming connections from your Azure Function's IP address
If you need any assistance on the above then I will suggest you to reach out to the postgres database for the configuration help or someone from your networking team that can help you with the setup so your DB can be accessed over internet.
If you need any assistance from the Azure function end then feel free to reach out to us in Microsoft QnA.