Home
%3CLINGO-SUB%20id%3D%22lingo-sub-368920%22%20slang%3D%22en-US%22%3EReset%20lost%20admin%20account%20password%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-368920%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Jul%2023%2C%202017%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId-1482485056%22%20id%3D%22toc-hId-1540665948%22%3ESymptom%3A%3C%2FH3%3E%3CBR%20%2F%3E%20If%20you%20lost%20your%20admin%20account%20password%2C%20or%20you%20need%20to%20change%20the%20password%20for%20any%20reason%20follow%20this%20article%20to%20reset%20your%20admin%20account%20password.%20%3CBR%20%2F%3E%3CH3%20id%3D%22toc-hId--1069671905%22%20id%3D%22toc-hId--1011491013%22%3EResolution%3A%3C%2FH3%3E%3CBR%20%2F%3E%20Option%201%3A%20Using%20Azure%20Portal%20%3CBR%20%2F%3E%3COL%3E%3CBR%20%2F%3E%3CLI%3EUsing%20Azure%20Portal%20open%20your%20Azure%20SQL%20%3CSTRONG%3E%20Server%20%3C%2FSTRONG%3E%20blade%20(do%20not%20confuse%20with%20the%20database%20blade)%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EMake%20sure%20you%20are%20in%20the%20Overview%20blade.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EClick%20on%20%22Reset%20password%22%20at%20the%20top%20of%20the%20overview%20blade.%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3ESet%20the%20new%20password%20and%20click%20save.%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FOL%3E%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F88945i7CEA30E111BC1EDA%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Figure%201%20%E2%80%93%20reset%20password%20using%20Azure%20Portal.%20%3CBR%20%2F%3E%20Option%202%20%E2%80%93%20Using%20Azure%20CLI%20%3CBR%20%2F%3E%3COL%3E%3CBR%20%2F%3E%3CLI%3E%3CBR%20%2F%3E%3CDIV%3EOpen%20Azure%20CLI%202.0%20%E2%80%93%20choose%20the%20right%20option%20for%20you%3C%2FDIV%3E%3CBR%20%2F%3E%3COL%3E%3CBR%20%2F%3E%3CLI%3EOn%20your%20workstation%20(Installation%20instructions%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcli%2Fazure%2Finstall-azure-cli%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20here%20%3C%2FA%3E%20)%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CBR%20%2F%3E%3CDIV%3EOn%20Azure%20Portal%20click%20the%20CLI%20button%3C%2FDIV%3E%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F88946i9FD91DABB9060D35%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Figure%202%20%E2%80%93%20Azure%20CLI%20using%20the%20Portal%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FOL%3E%3CBR%20%2F%3E%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CBR%20%2F%3E%3CDIV%3ERun%20the%20following%20command%2C%20change%20the%20names%20to%20match%20your%20environment.%3C%2FDIV%3E%3CBR%20%2F%3E%3CBLOCKQUOTE%3Eaz%20sql%20server%20update%20--resource-group%20%3CRESOURCEGROUPNAME%3E%20--name%20%3CSERVERNAME%3E%20--admin-password%20%3CNEWADMINACCOUNTPASSWORD%3E%3C%2FNEWADMINACCOUNTPASSWORD%3E%3C%2FSERVERNAME%3E%3C%2FRESOURCEGROUPNAME%3E%3C%2FBLOCKQUOTE%3E%3CBR%20%2F%3E%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FOL%3E%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F88947i97A977A2B9CC9F42%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Figure%203%20%E2%80%93%20Output%20of%20the%20CLI%20on%20Azure%20Portal%20%E2%80%93%20Blurred%20%3CBR%20%2F%3E%20Option%203%20%E2%80%93%20PowerShell%20%3CBR%20%2F%3E%3COL%3E%3CBR%20%2F%3E%3CLI%3EMake%20sure%20you%20have%20AzureRM%20PowerShell%20module%20installed%20(installation%20instructions%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fazure%2Finstall-azurerm-ps%3Fview%3Dazurermps-4.2.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20here%20%3C%2FA%3E%20)%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E%3CBR%20%2F%3E%3CDIV%3ERun%20the%20following%20PowerShell%20cmdlets%3C%2FDIV%3E%3CBR%20%2F%3E%3CBLOCKQUOTE%3ELogin-AzureRmAccount%3C%2FBLOCKQUOTE%3E%3CBR%20%2F%3E%3CBLOCKQUOTE%3ESet-AzureRmSqlServer%20-ResourceGroupName%20%3CRESOURCEGROUPNAME%3E%20-ServerName%20%3CSERVERNAME%3E%20-SqlAdministratorPassword%20(ConvertTo-SecureString%20%22%3CNEWADMINACCOUNTPASSWORD%3E%22%20-AsPlainText%20-Force)%20%3CBR%20%2F%3E%3C%2FNEWADMINACCOUNTPASSWORD%3E%3C%2FSERVERNAME%3E%3C%2FRESOURCEGROUPNAME%3E%3C%2FBLOCKQUOTE%3E%3CBR%20%2F%3E%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FOL%3E%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F88948i059581D427162ED2%22%20%2F%3E%20%3CBR%20%2F%3E%3CP%3EFigure%204%20%E2%80%93%20PowerShell%20output%20%E2%80%93%20Blurred%3C%2FP%3E%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Option%204%20%E2%80%93%20Using%20T-SQL%20%3CBR%20%2F%3E%20This%20is%20the%20not%20common%20option%20%E2%80%93%20as%20if%20you%20are%20connected%20to%20SQL%20you%20have%20the%20password%20to%20another%20admin%20account%20%3CBR%20%2F%3E%3COL%3E%3CBR%20%2F%3E%3CLI%3EUsing%20any%20client%20(SSMS%20%2F%20sqlcmd%20%2F%20PowerShell%20invoke-SQLcmd%20cmdlet%20or%20any%20other%20client%20application)%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EConnect%20to%20the%20master%20database%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3ERun%20the%20following%20T-SQL%20command%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FOL%3E%3CBR%20%2F%3E%3CBLOCKQUOTE%3EALTER%20LOGIN%20%3CADMINACCOUNTNAME%3E%20WITH%20Password%3D'NewAdminAccountPassword'%3B%20%3CBR%20%2F%3E%3C%2FADMINACCOUNTNAME%3E%3C%2FBLOCKQUOTE%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-368920%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Jul%2023%2C%202017%20Symptom%3AIf%20you%20lost%20your%20admin%20account%20password%2C%20or%20you%20need%20to%20change%20the%20password%20for%20any%20reason%20follow%20this%20article%20to%20reset%20your%20admin%20account%20password.%3C%2FLINGO-TEASER%3E
Microsoft
First published on MSDN on Jul 23, 2017

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

  1. Using Azure Portal open your Azure SQL Server blade (do not confuse with the database blade)

  2. Make sure you are in the Overview blade.

  3. Click on "Reset password" at the top of the overview blade.

  4. Set the new password and click save.




Figure 1 – reset password using Azure Portal.
Option 2 – Using Azure CLI


  1. Open Azure CLI 2.0 – choose the right option for you


    1. On your workstation (Installation instructions here )


    2. On Azure Portal click the CLI button



      Figure 2 – Azure CLI using the Portal




  2. 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

  1. Make sure you have AzureRM PowerShell module installed (installation instructions here )


  2. 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

  1. Using any client (SSMS / sqlcmd / PowerShell invoke-SQLcmd cmdlet or any other client application)

  2. Connect to the master database

  3. Run the following T-SQL command


ALTER LOGIN <AdminAccountName> WITH Password='NewAdminAccountPassword';