Error running the code on bash window on azure for postgre servee

Dnaq2020 21 Reputation points
2022-02-24T07:04:18.793+00:00

I tried to run bash code on azure for displaying the list of database for postgre database and found error.

az postgres db list -g testgroup -s mydatabase

(ResourceNotFound) The Resource 'Microsoft.DBforPostgreSQL/servers/xxxxxxxxxxxxxxxx' under resource group 'xxxxxx' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix

Azure Database for PostgreSQL
0 comments No comments
{count} votes

Accepted answer
  1. Anurag Sharma 17,606 Reputation points
    2022-02-24T09:29:48.817+00:00

    Hi @Dnaq2020 , welcome to Microsoft Q&A forum.

    It seems you are trying to connect Azure Database for PostgreSQL through CLI commands using Bash but facing the error. This error can come due to multiple reasons:

    1. If we are putting the fully qualified server name ending with 'postgres.database.azure.com', we just need to use the server name.
    2. If the server name or resource group name is wrong

    Another thing is, the command you are using is related to Azure PostgreSQL Single Server. And if you have created the flexible server then also it will not work and similar error could come.

    Could you please check if you have created flexible server as mentioned in the below screenshot?

    177443-image.png

    If yes, then please use the below command to connect to it:

    az postgres flexible-server db list --resource-group <rescgrp> --server-name <yourservername>  
    

    You can find more details on below link:

    az postgres flexible-server

    Please let us know if this helps or else we can discuss further on the issue.

    ----------

    If answer is helpful you can click on 177462-image.png as it helps other members of the Microsoft Q&A community who have similar questions and are looking for solutions. Thank you for helping to improve Microsoft Q&A!

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Dnaq2020 21 Reputation points
    2022-02-24T11:06:42.68+00:00

    Server name is right but I created flexible server by mistake, again created postgre server and it worked for me. Thank you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.