Hi @Oury Ba-MSFT ,
I just found the reason for the issue. DefaultAzureCredential class from azure identity library get the token credential by sequentially trying several different credential types. I believe the order is env file> azure cli> managed identity which I saw somewhere in the documentation and I was using an env file like suggested in the tutorial where i had given the database user value a postegrsql user initially and entra admin of database later.However, both of the values threw the error I mentioned above which is picking the local admin of my VM instead of the user I mentioned in env file. Then I tried to hard code the entra admin of database in code file (username@domain.com) and I was able to successfully connect to databse locally.
- How can we make sure the use of value mentioned in env file which is failing at this moment instead of hard coding?
- The service connector which is connection the app service with databse create a user. Is this user I need to mention as databse user when i deploy the code to app service?