A very common task that I’m used to as a DevOps engineer working in the cloud, is resetting forgotten or lost passwords for server or database access. Although one of the best practices is to store passwords in a key management service, like Azure Key Vault, people don’t always follow security best practices.
Also, there could be another common scenario where you’ll have to change the password every 3 or 6 months as a part of a password policy, for example the Azure SQL database Administrator password.
There is a way to change the password using the Azure Portal that I’ll cover in a future, but today I’ll show you how to change the password quickly and easier from the Azure CLI.
- Azure subscription
- Azure SQL database
Reset Administrator account password
Step 1. Open Terminal and login to the Azure Portal.
It will open a new window using the default browser where you will be prompted for email and password.
Step 2. Run the following command:
az sql server update --name "devcoopsdbserver" --resource-group "azure-sql-db-rg" --admin-password "<insert_new_admin_password_here>"
Periodically resetting the Azure SQL Administrator account password could lead us to an automation scenario. This can be quite useful when there is a password policy that apply to the Administrator account. Always use automation when possible.
Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.