Set-AzSqlInstanceActiveDirectoryAdministrator
Provisions a Microsoft Entra administrator for SQL Managed Instance.
Syntax
Set-AzSqlInstanceActiveDirectoryAdministrator
[-DisplayName] <String>
[-ObjectId] <Guid>
[-ResourceGroupName] <String>
[-InstanceName] <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzSqlInstanceActiveDirectoryAdministrator
[-DisplayName] <String>
[-ObjectId] <Guid>
-InputObject <AzureSqlManagedInstanceModel>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzSqlInstanceActiveDirectoryAdministrator
[-DisplayName] <String>
[-ObjectId] <Guid>
[-ResourceId] <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Set-AzSqlInstanceActiveDirectoryAdministrator cmdlet provisions a Microsoft Entra administrator for AzureSQL Managed Instance in the current subscription. You can provision only one administrator at a time. The following members of Microsoft Entra ID can be provisioned as a SQL Managed Instance administrator:
- Native members of Microsoft Entra ID
- Federated members of Microsoft Entra ID
- Microsoft Entra groups created as security groups Imported members from other Azure ADs are not supported as administrators. 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 Microsoft Entra group as an administrator.
Examples
Example 1: Provision an administrator group for a managed instance associated with resource group
Set-AzSqlInstanceActiveDirectoryAdministrator -ResourceGroupName "ResourceGroup01" -InstanceName "ManagedInstance01" -DisplayName "DBAs" -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb"
ResourceGroupName InstanceName DisplayName ObjectId
----------------- ----------------- ----------- --------
ResourceGroup01 ManagedInstance01 DBAs aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb
This command provisions a Microsoft Entra administrator group named DBAs for the managed instance named ManagedInstance01. This server is associated with resource group ResourceGroup01.
Example 2: Provision an administrator user using managed instance object
Get-AzSqlInstance -ResourceGroupName "ResourceGroup01" -InstanceName "ManagedInstance01" | Set-AzSqlInstanceActiveDirectoryAdministrator -DisplayName "David Chew" -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc"
ResourceGroupName InstanceName DisplayName ObjectId
----------------- ----------------- ----------- --------
Resourcegroup01 ManagedInstance01 David Chew bbbbbbbb-1111-2222-3333-cccccccccccc
This command provisions a Microsoft Entra user as an administrator from the managed instance object.
Example 3: Provision an administrator using managed instance resource identifier
Get-AzSqlInstance -ResourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ResourceGroup01/providers/Microsoft.Sql/managedInstances/ManagedInstance01" | Set-AzSqlInstanceActiveDirectoryAdministrator -DisplayName "David Chew" -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc"
ResourceGroupName InstanceName DisplayName ObjectId
----------------- ----------------- ----------- --------
Resourcegroup01 ManagedInstance01 David Chew bbbbbbbb-1111-2222-3333-cccccccccccc
This command provisions a Microsoft Entra user as an administrator using managed instance resource identifier.
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DisplayName
Specifies the display name of the user or group for whom to grant permissions. This display name must exist in the active directory associated with the current subscription.
Type: | String |
Position: | 2 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-InputObject
The managed instance object to use.
Type: | AzureSqlManagedInstanceModel |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-InstanceName
SQL Managed Instance name.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ObjectId
Specifies the object ID of the user or group in Microsoft Entra ID for which to grant permissions.
Type: | Guid |
Position: | 3 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceGroupName
The name of the resource group.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ResourceId
The resource id of instance to use
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
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: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
Outputs
AzureSqlInstanceActiveDirectoryAdministratorModel