Set-​Azure​Rm​Sql​Server​Active​Directory​Administrator

Provisions an Azure AD administrator for SQL Server.

Syntax

Set-AzureRmSqlServerActiveDirectoryAdministrator
   [-ResourceGroupName] <String>
   [-ServerName] <String>
   [-DisplayName] <String>
   [[-ObjectId] <Guid>]
   [-Confirm]
   [-WhatIf]
   [<CommonParameters>]

Description

The Set-AzureRmSqlServerActiveDirectoryAdministrator cmdlet provisions an Azure Active Directory (Azure AD) administrator for AzureSQL Server in the current subscription.

You can provision only one administrator at a time.

The following members of Azure AD can be provisioned as a SQL Server administrator:

  • Native members of Azure AD
  • Federated members of Azure AD
  • Imported members from other Azure ADs who are native or federated members
  • Azure AD groups created as security groups

Microsoft accounts, such as those in the Outlook.com, Hotmail.com, or Live.com domains, are not supported as administrators. Other guest accounts, such as those in the Gmail.com or Yahoo.com domains, are not supported as administrators.

We recommend that you provision a dedicated Azure AD group as an administrator.

Examples

Example 1: Provision an administrator group for a server

PS C:\>Set-AzureRmSqlServerActiveDirectoryAdministrator -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DisplayName "DBAs" 
ResourceGroupName ServerName DisplayName ObjectId 
----------------- ---------- ----------- -------- 
ResourceGroup01   Server01   DBAs        40b79501-b343-44ed-9ce7-da4c8cc7353b

This command provisions an Azure AD administrator group named DBAs for the server named Server01. This server is associated with resource group ResourceGroup01.

Example 2: Provision an administrator user for a server

PS C:\>Set-AzureRmSqlServerActiveDirectoryAdministrator -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DisplayName "David Chew"
ResourceGroupName ServerName DisplayName ObjectId 
----------------- ---------- ----------- -------- 
resourcegroup01   server01   David Chew  11E95548-B179-4FE1-9AF4-ACA49D13ABB9

This command provisions an Azure AD user as an administrator for the server named Server01.

Example 3: Provision an administrator group by specifying its ID

PS C:\>Set-AzureRmSqlServerActiveDirectoryAdministrator -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DisplayName "DBAs" -ObjectId "40b79501-b343-44ed-9ce7-da4c8cc7353b"
ResourceGroupName ServerName DisplayName ObjectId 
----------------- ---------- ----------- -------- 
ResourceGroup01   Server01   DBAs        40b79501-b343-44ed-9ce7-da4c8cc7353b

This command provisions an Azure AD administrator group named DBAs for the server named Server01. The command specifies an ID for the ObjectId parameter. This makes sure that that the command succeeds even if the display name of the group is not unique.

Required Parameters

-DisplayName

Specifies the display name of the Azure AD administrator that this cmdlet provisions.

Type:String
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceGroupName

Specifies the name of the resource group to which the server is assigned.

Type:String
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServerName

Specifies the name of the SQL Server for which this cmdlet provisions an administrator.

Type:String
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-ObjectId

Specifies the unique ID of the Azure AD administrator that this cmdlet provisions. If the display name is not unique, you must specify a value for this parameter.

Type:Guid
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Model.AzureSqlServerActiveDirectoryAdministratorModel