首页 > 解决方案 > 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?

Could it be done via portal or using some script?

标签: azureazure-sql-managed-instance

解决方案


重置密码的最简单方法是转到 Azure 门户,打开实例详细信息刀片并按重置密码按钮:

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

作为替代方案,您可以使用 AzureRm.Sql PowerShell 库和Set-AzureRmSqlManagedInstance命令:

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

还可以将 Azure CLI 与az sql mi update命令一起使用:

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

推荐阅读