Issues with password authentication

Richard Jackson 46 Reputation points

I've been running through the "Deploy a Django application to Azure by using PostgreSQL" MS Learn module ( and have encountered myriad issues with deploying/connecting to a PostGres database - specifically the steps located at "Unit 6: Deploy to Azure":

The codebase use is Microsoft's own "Solution" code for this exercise, found here:

1) Could someone who knows what they're doing please run through this and confirm whether it works? As I haven't had this run successfully I'd really appreciate if someone could confirm whether this does work and whether it's my issue. A video of the walkthrough would also be incredibly useful...!

2) After SSH'ing into the application my attempts to run a python migrate command ran into a "port 5432 failed: FATAL: password authentication failed for user" error, which regardless of how I'd set the Azure application settings (/environment variables). In the context of the below code, my understanding is that the following environment variables are required:

  • DBNAME: shelters # name of the database
  • DBHOST: jacksorjacksor_shelter_dbserver01 # name of the database server
  • DBUSER: shelter_admin # name of the admin account of the database server
  • DBPASS: 86i^z5#emSk6wu3t10nC* # admin password for the database server, defined in the learning module instructions
  • SECRET_KEY: 86i^z5#emSk6wu3t10nC* # secret key for the app - I used various when testing out just so it was never empty

This then fits into the file, as defined in the /project/



   DATABASES = {  
       "default": {  
           "ENGINE": "django.db.backends.postgresql",  
           "NAME": os.environ["DBNAME"],  
           "HOST": hostname + "",  
           "USER": os.environ["DBUSER"] + "@" + hostname,  
           "PASSWORD": os.environ["DBPASS"],  

Please advise on what I'm doing wrong! Have spent a huge amount of time on this over the weekend and am entirely stuck - ultimately went with SQLite which worked!



Azure Database for PostgreSQL
{count} votes

1 answer

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 25,687 Reputation points Microsoft Employee

    Hi, anonymous user Apologies for the delay in my response.
    I tried deploying the PostgreSQL database as per the steps in Unit 6 and I did not see any issues, the issue could be you might have not created the firewall, or you need to add the firewall again.