如何使用Powershell将AD Administrator添加到Azure SQL托管实例

时间:2018-10-12 16:38:29

标签: sql azure powershell cloud azure-sql-database

我需要通过PowerShell将AD管理员添加到Azure SQL托管实例中,以自动化部署。

但是,似乎无法使用Azure PowerShell或REST API来实现。 到目前为止,我一直在尝试将其设置为普通的SQL Server。

$sql = Get-AzureRmResource -ResourceGroupName "RSGName" -Name "InstanceName" 
-ResourceType "Microsoft.Sql/managedInstances" -ExpandProperties

$dbaId = Get-AzureRmADGroup -DisplayName "ADGroupName" | Select-Object Id

Set-AzureRmSqlServerActiveDirectoryAdministrator -DisplayName "ADGroupName" 
-ResourceGroupName "RSGName" -ServerName "InstanceName" -ObjectId $dbaId.Id

但这给我一个错误,说无法在资源组上找到服务器。

0 个答案:

没有答案
相关问题