Hi @Younes ,
Welcome to Microsoft Q&A platform and thanks for using Azure services.
As I understand your question, upon execution of az postgres flexible-server execute
, you are getting error to validate firewall and network settings.
For firewall, you can refer this documentation to create Firewall rule: firewall-rule
Try to connect to the server using az postgres flexible-server connect -n postgresdemoserver -u dbuser -p "dbpassword" -d postgres
If the connection failed, try these solutions:
- Check if port 5432 is open on your client machine.
- if your server administrator user name and password are correct
- if you have configured firewall rule for your client machine(as mentioned above)
- if you've configured your server with private access in virtual networking, make sure your client machine is in the same virtual network.
Further to Note:
- The virtual network and subnet should be in the same region and subscription as your flexible server.
- The virtual network should not have any resource lock set at the VNET or subnet level. Make sure to remove any lock (Delete or Read only) from your VNET and all subnets before creating the server in a virtual network, and you can set it back after server creation.
Additionally, please go through the below mentioned link for better understanding of Networking in Flexible server:
how-to-manage-virtual-network-portal
concepts-networking
concepts-firewall-rules
Hope this helps. If this answers your query, do click Accept Answer
and Up-Vote
for the same. And, if you have any further query do let us know.