A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/rest/api/sql/server-azure-ad-administrators/create-or-update below:

Server Azure AD Administrators - Create Or Update - REST API (Azure SQL Database)

Server Azure AD Administrators - Create Or Update

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 True

AdministratorName

The name of server active directory administrator.

resourceGroupName

path True

string

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 True

string

The name of the server.

subscriptionId

path True

string

The subscription ID that identifies an Azure subscription.

api-version

query True

string

The API version to use for the request.

Request Body Name Required Type Description properties.login True

string

Login name of the server administrator.

properties.sid True

string (uuid)

SID (object ID) of the server administrator.

properties.administratorType

AdministratorType

Type of the sever administrator.

properties.tenantId

string (uuid)

Tenant ID of the administrator.

Responses Name Type Description 200 OK

ServerAzureADAdministrator

Successfully updated a Azure Active Directory administrator.

201 Created

ServerAzureADAdministrator

Successfully created a Azure Active Directory administrator.

202 Accepted

Accepted

Headers

Location: string

Other Status Codes

ErrorResponse

*** Error Responses: ***

Examples Creates or updates an existing Azure Active Directory administrator. Sample request
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 AdministratorType

Enumeration

Type of the sever administrator.

Value Description ActiveDirectory ErrorAdditionalInfo

Object

The resource management error additional info.

Name Type Description info

object

The additional info.

type

string

The additional info type.

ErrorDetail

Object

The error detail.

Name Type Description additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Object

Error response

Name Type Description error

ErrorDetail

The error object.

ServerAzureADAdministrator

Object

Azure Active Directory administrator.

Name Type Description id

string

Resource ID.

name

string

Resource name.

properties.administratorType

AdministratorType

Type of the sever administrator.

properties.azureADOnlyAuthentication

boolean

Azure Active Directory only Authentication enabled.

properties.login

string

Login name of the server administrator.

properties.sid

string (uuid)

SID (object ID) of the server administrator.

properties.tenantId

string (uuid)

Tenant ID of the administrator.

type

string

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