Symptom:
If you lost your admin account password, or you need to change the password for any reason follow this article to reset your admin account password.
Resolution:
Option 1: Using Azure Portal
- Using Azure Portal open your Azure SQL Server blade.
- Make sure you are in the Overview blade.
- Click on "Reset password" at the top of the overview blade.
- Set the new password and click save.
Figure 1 – reset password using Azure Portal.
Option 2 – Using Azure CLI
-
Open Azure CLI 2.0 – choose the right option for you
- On your workstation (Installation instructions here)
-
On Azure Portal click the CLI button
Figure 2 – Azure CLI using the Portal
-
Run the following command, change the names to match your environment.
az sql server update --resource-group <ResourceGroupName> --name <Servername> --admin-password <NewAdminAccountPassword>
Figure 3 – Output of the CLI on Azure Portal – Blurred
Option 3 – PowerShell
- Make sure you have AzureRM PowerShell module installed (installation instructions here)
-
Run the following PowerShell cmdlets
Login-AzureRmAccount
Set-AzureRmSqlServer -ResourceGroupName <ResourceGroupName> -ServerName <ServerName> -SqlAdministratorPassword (ConvertTo-SecureString "<NewAdminAccountPassword>" -AsPlainText -Force)
Figure 4 – PowerShell output – Blurred
Option 4 – Using T-SQL
This is the not common option – as if you are connected to SQL you have the password to another admin account
- Using any client (SSMS / sqlcmd / PowerShell invoke-SQLcmd cmdlet or any other client application)
- Connect to the master database
- Run the following T-SQL command
ALTER LOGIN <AdminAccountName> WITH Password='NewAdminAccountPassword';