Creates or updates an existing Azure Active Directory administrator.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/administrators/ActiveDirectory?api-version=2023-08-01
URI Parameters Name In Required Type Description
administratorName
path TrueThe name of server active directory administrator.
resourceGroupName
path Truestring
The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
serverName
path Truestring
The name of the server.
subscriptionId
path Truestring
The subscription ID that identifies an Azure subscription.
api-version
query Truestring
The API version to use for the request.
Request Body Name Required Type Description properties.login Truestring
Login name of the server administrator.
properties.sid Truestring (uuid)
SID (object ID) of the server administrator.
properties.administratorTypeType of the sever administrator.
properties.tenantIdstring (uuid)
Tenant ID of the administrator.
Responses Name Type Description 200 OKSuccessfully updated a Azure Active Directory administrator.
201 CreatedSuccessfully created a Azure Active Directory administrator.
202 AcceptedAccepted
Headers
Location: string
Other Status Codes*** Error Responses: ***
400 ManagedInstanceStoppingOrStopped - Conflicting operation submitted while instance is in stopping/stopped state
400 ManagedInstanceStarting - Conflicting operation submitted while instance is in starting state
400 InvalidServerAdministratorTypePropertyName - Server active directory administrator type should be ActiveDirectory
400 InvalidResourceRequestBody - The resource or resource properties in the request body is empty or invalid.
400 InvalidServerAzureADOnlyAuthenticationParameter - User tried to set AzureADOnlyAuthentication parameter to false which is not allowed, please use azureADOnlyAuthentications API instead.
400 InvalidServerAzureADAdminDeleteOperation - User tried to delete server Azure Active Azure admin when AzureADOnlyAuthentication is set, please use azureADOnlyAuthentications API first.
400 ServerAdministratorNameAlreadyExists - User tried to set the external admin and the principal name already exists in the 'master' database.
404 ServerNotInSubscriptionResourceGroup - Specified server does not exist in the specified resource group and subscription.
404 SubscriptionDoesNotHaveServer - The requested server was not found
404 OperationIdNotFound - The operation with Id does not exist.
409 CannotCancelOperation - The management operation is in a state that cannot be cancelled.
409 OperationCancelled - The operation has been cancelled by user.
409 OperationInterrupted - The operation on the resource could not be completed because it was interrupted by another operation on the same resource.
429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.
429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.
500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.
503 TooManyRequests - Requests beyond max requests that can be processed by available resources.
PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/administrators/ActiveDirectory?api-version=2023-08-01
{
"properties": {
"administratorType": "ActiveDirectory",
"login": "bob@contoso.com",
"sid": "c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c",
"tenantId": "c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"
}
}
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Sql.Models;
using Azure.ResourceManager.Sql;
// Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/stable/2023-08-01/examples/AdministratorCreateOrUpdate.json
// this example is just showing the usage of "ServerAzureADAdministrators_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SqlServerResource created on azure
// for more information of creating SqlServerResource, please refer to the document of SqlServerResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "sqlcrudtest-4799";
string serverName = "sqlcrudtest-6440";
ResourceIdentifier sqlServerResourceId = SqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
SqlServerResource sqlServer = client.GetSqlServerResource(sqlServerResourceId);
// get the collection of this SqlServerAzureADAdministratorResource
SqlServerAzureADAdministratorCollection collection = sqlServer.GetSqlServerAzureADAdministrators();
// invoke the operation
SqlAdministratorName administratorName = SqlAdministratorName.ActiveDirectory;
SqlServerAzureADAdministratorData data = new SqlServerAzureADAdministratorData
{
AdministratorType = SqlAdministratorType.ActiveDirectory,
Login = "bob@contoso.com",
Sid = Guid.Parse("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"),
TenantId = Guid.Parse("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"),
};
ArmOperation<SqlServerAzureADAdministratorResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, administratorName, data);
SqlServerAzureADAdministratorResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SqlServerAzureADAdministratorData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/administrators/ActiveDirectory",
"name": "ActiveDirectory",
"type": "Microsoft.Sql/servers/administrators",
"properties": {
"administratorType": "ActiveDirectory",
"login": "bob@contoso.com",
"sid": "c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c",
"tenantId": "c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c",
"azureADOnlyAuthentication": true
}
}
{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-4799/providers/Microsoft.Sql/servers/sqlcrudtest-6440/administrators/ActiveDirectory",
"name": "activeDirectory",
"type": "Microsoft.Sql/servers/administrators",
"properties": {
"administratorType": "ActiveDirectory",
"login": "bob@contoso.com",
"sid": "c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c",
"tenantId": "c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c",
"azureADOnlyAuthentication": true
}
}
Definitions AdministratorName
Enumeration
The name of server active directory administrator.
Value Description ActiveDirectory AdministratorTypeEnumeration
Type of the sever administrator.
Value Description ActiveDirectory ErrorAdditionalInfoObject
The resource management error additional info.
Name Type Description infoobject
The additional info.
typestring
The additional info type.
ErrorDetailObject
The error detail.
Name Type Description additionalInfoThe error additional info.
codestring
The error code.
detailsThe error details.
messagestring
The error message.
targetstring
The error target.
ErrorResponseObject
Error response
Name Type Description errorThe error object.
ServerAzureADAdministratorObject
Azure Active Directory administrator.
Name Type Description idstring
Resource ID.
namestring
Resource name.
properties.administratorTypeType of the sever administrator.
properties.azureADOnlyAuthenticationboolean
Azure Active Directory only Authentication enabled.
properties.loginstring
Login name of the server administrator.
properties.sidstring (uuid)
SID (object ID) of the server administrator.
properties.tenantIdstring (uuid)
Tenant ID of the administrator.
typestring
Resource type.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4