Prateek Chaudhary
Prateek Chaudhary

Reputation: 139

Reset Azure PostgreSQL Server User Password through CLI

How to change/reset the password for the User in Azure Postgresql Server through CLI. I know there's a way how to reset password through Portal but am looking for resetting through Azure CLI .

I tried ALTER USER {user} WITH PASSWORD '{password}'; but it needs superuser access. As far as I know, azure_superuser access is not granted so is there any way how to reset through CLI?

Upvotes: 2

Views: 3739

Answers (1)

Alberto Morillo
Alberto Morillo

Reputation: 15618

On a single Postgresql server, you can change the administrator role's password with the following CLI command:

az postgres server update --resource-group myresourcegroup --name mydemoserver --admin-password <new-password>

On a flexible Postgresql server, You can change the administrator role's password with this CLI command

az postgres flexible-server update --resource-group myresourcegroup --name mydemoserver --admin-password <new-password>

Choose a password that has a minimum of 8 characters and a maximum of 128 characters. The password must contain characters from three of the following categories:

  • English uppercase letters
  • English lowercase letters
  • Numbers
  • Non-alphanumeric characters

Upvotes: 5

Related Questions