PostgreSQL Flexible Server stuck in "Stopping" state – cannot restart or connect

Mostafiz 20 Reputation points
2025-05-19T11:03:35.25+00:00

I am experiencing an issue with my Azure PostgreSQL Flexible Server The server has been stuck in the Stopping state for an extended period (more than several hours) and is unresponsive.

The server is unreachable, and I cannot connect via psql or through the Azure portal.

Attempts to restart or stop the server through the portal and Azure CLI have failed with the error: (InternalServerError) An unexpected error occurred while processing the request.

The server's SKU is Standard_B1ms.

Firewall rules and network connectivity have been verified and are properly configured.

The server was working normally before and no recent changes or maintenance were performed on my side.

I have tried commands such as az postgres flexible-server restart and az postgres flexible-server show which confirm the server state is still "Stopping" and operations return errors indicating the server is busy or an internal error occurred.

I have confirmed no resource locks are blocking operations.

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

Accepted answer
  1. Vijayalaxmi Kattimani 3,250 Reputation points Microsoft External Staff Moderator
    2025-05-19T11:55:28.6333333+00:00

    Hi Mostafiz

    Greetings!

    As we understand that, you are facing an issue with Azure Database for PostgreSQL – Flexible Server where the server becomes stuck in the "Stopping" state and is unresponsive to CLI or portal commands. 

    Here are a few steps you might consider:

    • Sometimes servers can take longer to stop due to ongoing processes. You might want to wait a little longer and check if the status changes.
    • Go to the Azure portal and check the service health dashboard. There might be some ongoing issues affecting the PostgreSQL service in your region.
    • If the server remains stuck, you could consider forcing a stop or restart. You can try using the Azure CLI with the --failover option to perform a forced operation: az postgres flexible-server restart --name <your-server-name> --resource-group <your-resource-group> --failover Forced
    • Use the Azure Monitor logs to check for errors or blockers. Run the following to query logs:
    az monitor log-analytics query \
             --workspace <workspace-id> \
             --analytics-query "AzureDiagnostics | where ResourceId == '<server-resource-id>'"
    
    • Confirm if the server has management locks that might be preventing the stop action using bash command: az resource lock list --resource-name <server-name> --resource-group <resource-group> --resource-type "Microsoft.DBforPostgreSQL/flexibleServers"
    • Remove locks if present: az resource lock delete --ids <lock-id>
    • If resource exhaustion is suspected, scale the server up temporarily using bash command: az postgres flexible-server update --name <server-name> --resource-group <resource-group> --sku-name GP_Gen5_4

    If the above steps do not resolve the issue, could you please share the requested details via private message as it will help us conduct a more thorough investigation.

    I hope this information helps. Please do let us know if you have any further queries.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.