简体   繁体   English

如何在Azure SQL托管实例上重置SQL管理员密码?

[英]How to reset sql admin password on Azure SQL Managed Instance?

How to reset the sql admin password on Azure SQL Managed Instance if there is only one user/admin and the admin password is lost/forgotten? 如果只有一个用户/管理员,并且管理员密码丢失/忘记了,如何在Azure SQL托管实例上重置sql管理员密码?

Could it be done via portal or using some script? 是否可以通过门户网站或使用某些脚本来完成?

The easiest way to reset the password is to go to the Azure portal, open the instance details blade and press Reset password button: 重置密码的最简单方法是转到Azure门户,打开实例详细信息刀片并按“ 重置密码”按钮:

使用Azure门户重置SQL管理员密码

As an alternative, you can use AzureRm.Sql PowerShell library and Set-AzureRmSqlManagedInstance command: 或者,可以使用AzureRm.Sql PowerShell库和Set-AzureRmSqlManagedInstance命令:

$InstancePassword = "Newpassword1234"
$SecureString = ConvertTo-SecureString $InstancePassword -AsPlainText -Force
Set-AzureRmSqlInstance -Name "managedinstance1" -ResourceGroupName "ResourceGroup01" -AdministratorPassword $SecureString 

You can also use Azure CLI with az sql mi update command: 您还可以将Azure CLI与az sql mi update命令一起使用:

az sql mi update -g mygroup -n myinstance -i -p mypassword

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM