1. Packages
  2. Azure Classic
  3. API Docs
  4. mysql
  5. FlexibleServerActiveDirectoryAdministratory

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.mysql.FlexibleServerActiveDirectoryAdministratory

Explore with Pulumi AI

Manages an Active Directory administrator on a MySQL Flexible Server

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const current = azure.core.getClientConfig({});
const example = new azure.core.ResourceGroup("example", {
    name: "example-resources",
    location: "West Europe",
});
const exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", {
    name: "exampleUAI",
    resourceGroupName: example.name,
    location: example.location,
});
const exampleFlexibleServer = new azure.mysql.FlexibleServer("example", {
    name: "example-mysqlfs",
    resourceGroupName: example.name,
    location: example.location,
    administratorLogin: "_admin_Terraform_892123456789312",
    administratorPassword: "QAZwsx123",
    skuName: "B_Standard_B1s",
    zone: "2",
    identity: {
        type: "UserAssigned",
        identityIds: [exampleUserAssignedIdentity.id],
    },
});
const exampleFlexibleServerActiveDirectoryAdministratory = new azure.mysql.FlexibleServerActiveDirectoryAdministratory("example", {
    serverId: exampleFlexibleServer.id,
    identityId: exampleUserAssignedIdentity.id,
    login: "sqladmin",
    objectId: current.then(current => current.clientId),
    tenantId: current.then(current => current.tenantId),
});
Copy
import pulumi
import pulumi_azure as azure

current = azure.core.get_client_config()
example = azure.core.ResourceGroup("example",
    name="example-resources",
    location="West Europe")
example_user_assigned_identity = azure.authorization.UserAssignedIdentity("example",
    name="exampleUAI",
    resource_group_name=example.name,
    location=example.location)
example_flexible_server = azure.mysql.FlexibleServer("example",
    name="example-mysqlfs",
    resource_group_name=example.name,
    location=example.location,
    administrator_login="_admin_Terraform_892123456789312",
    administrator_password="QAZwsx123",
    sku_name="B_Standard_B1s",
    zone="2",
    identity={
        "type": "UserAssigned",
        "identity_ids": [example_user_assigned_identity.id],
    })
example_flexible_server_active_directory_administratory = azure.mysql.FlexibleServerActiveDirectoryAdministratory("example",
    server_id=example_flexible_server.id,
    identity_id=example_user_assigned_identity.id,
    login="sqladmin",
    object_id=current.client_id,
    tenant_id=current.tenant_id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/authorization"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/mysql"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := core.GetClientConfig(ctx, map[string]interface{}{}, nil)
		if err != nil {
			return err
		}
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("example-resources"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleUserAssignedIdentity, err := authorization.NewUserAssignedIdentity(ctx, "example", &authorization.UserAssignedIdentityArgs{
			Name:              pulumi.String("exampleUAI"),
			ResourceGroupName: example.Name,
			Location:          example.Location,
		})
		if err != nil {
			return err
		}
		exampleFlexibleServer, err := mysql.NewFlexibleServer(ctx, "example", &mysql.FlexibleServerArgs{
			Name:                  pulumi.String("example-mysqlfs"),
			ResourceGroupName:     example.Name,
			Location:              example.Location,
			AdministratorLogin:    pulumi.String("_admin_Terraform_892123456789312"),
			AdministratorPassword: pulumi.String("QAZwsx123"),
			SkuName:               pulumi.String("B_Standard_B1s"),
			Zone:                  pulumi.String("2"),
			Identity: &mysql.FlexibleServerIdentityArgs{
				Type: pulumi.String("UserAssigned"),
				IdentityIds: pulumi.StringArray{
					exampleUserAssignedIdentity.ID(),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = mysql.NewFlexibleServerActiveDirectoryAdministratory(ctx, "example", &mysql.FlexibleServerActiveDirectoryAdministratoryArgs{
			ServerId:   exampleFlexibleServer.ID(),
			IdentityId: exampleUserAssignedIdentity.ID(),
			Login:      pulumi.String("sqladmin"),
			ObjectId:   pulumi.String(current.ClientId),
			TenantId:   pulumi.String(current.TenantId),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var current = Azure.Core.GetClientConfig.Invoke();

    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "example-resources",
        Location = "West Europe",
    });

    var exampleUserAssignedIdentity = new Azure.Authorization.UserAssignedIdentity("example", new()
    {
        Name = "exampleUAI",
        ResourceGroupName = example.Name,
        Location = example.Location,
    });

    var exampleFlexibleServer = new Azure.MySql.FlexibleServer("example", new()
    {
        Name = "example-mysqlfs",
        ResourceGroupName = example.Name,
        Location = example.Location,
        AdministratorLogin = "_admin_Terraform_892123456789312",
        AdministratorPassword = "QAZwsx123",
        SkuName = "B_Standard_B1s",
        Zone = "2",
        Identity = new Azure.MySql.Inputs.FlexibleServerIdentityArgs
        {
            Type = "UserAssigned",
            IdentityIds = new[]
            {
                exampleUserAssignedIdentity.Id,
            },
        },
    });

    var exampleFlexibleServerActiveDirectoryAdministratory = new Azure.MySql.FlexibleServerActiveDirectoryAdministratory("example", new()
    {
        ServerId = exampleFlexibleServer.Id,
        IdentityId = exampleUserAssignedIdentity.Id,
        Login = "sqladmin",
        ObjectId = current.Apply(getClientConfigResult => getClientConfigResult.ClientId),
        TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.CoreFunctions;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.authorization.UserAssignedIdentity;
import com.pulumi.azure.authorization.UserAssignedIdentityArgs;
import com.pulumi.azure.mysql.FlexibleServer;
import com.pulumi.azure.mysql.FlexibleServerArgs;
import com.pulumi.azure.mysql.inputs.FlexibleServerIdentityArgs;
import com.pulumi.azure.mysql.FlexibleServerActiveDirectoryAdministratory;
import com.pulumi.azure.mysql.FlexibleServerActiveDirectoryAdministratoryArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var current = CoreFunctions.getClientConfig();

        var example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("example-resources")
            .location("West Europe")
            .build());

        var exampleUserAssignedIdentity = new UserAssignedIdentity("exampleUserAssignedIdentity", UserAssignedIdentityArgs.builder()
            .name("exampleUAI")
            .resourceGroupName(example.name())
            .location(example.location())
            .build());

        var exampleFlexibleServer = new FlexibleServer("exampleFlexibleServer", FlexibleServerArgs.builder()
            .name("example-mysqlfs")
            .resourceGroupName(example.name())
            .location(example.location())
            .administratorLogin("_admin_Terraform_892123456789312")
            .administratorPassword("QAZwsx123")
            .skuName("B_Standard_B1s")
            .zone("2")
            .identity(FlexibleServerIdentityArgs.builder()
                .type("UserAssigned")
                .identityIds(exampleUserAssignedIdentity.id())
                .build())
            .build());

        var exampleFlexibleServerActiveDirectoryAdministratory = new FlexibleServerActiveDirectoryAdministratory("exampleFlexibleServerActiveDirectoryAdministratory", FlexibleServerActiveDirectoryAdministratoryArgs.builder()
            .serverId(exampleFlexibleServer.id())
            .identityId(exampleUserAssignedIdentity.id())
            .login("sqladmin")
            .objectId(current.applyValue(getClientConfigResult -> getClientConfigResult.clientId()))
            .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resources
      location: West Europe
  exampleFlexibleServer:
    type: azure:mysql:FlexibleServer
    name: example
    properties:
      name: example-mysqlfs
      resourceGroupName: ${example.name}
      location: ${example.location}
      administratorLogin: _admin_Terraform_892123456789312
      administratorPassword: QAZwsx123
      skuName: B_Standard_B1s
      zone: '2'
      identity:
        type: UserAssigned
        identityIds:
          - ${exampleUserAssignedIdentity.id}
  exampleUserAssignedIdentity:
    type: azure:authorization:UserAssignedIdentity
    name: example
    properties:
      name: exampleUAI
      resourceGroupName: ${example.name}
      location: ${example.location}
  exampleFlexibleServerActiveDirectoryAdministratory:
    type: azure:mysql:FlexibleServerActiveDirectoryAdministratory
    name: example
    properties:
      serverId: ${exampleFlexibleServer.id}
      identityId: ${exampleUserAssignedIdentity.id}
      login: sqladmin
      objectId: ${current.clientId}
      tenantId: ${current.tenantId}
variables:
  current:
    fn::invoke:
      function: azure:core:getClientConfig
      arguments: {}
Copy

Create FlexibleServerActiveDirectoryAdministratory Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new FlexibleServerActiveDirectoryAdministratory(name: string, args: FlexibleServerActiveDirectoryAdministratoryArgs, opts?: CustomResourceOptions);
@overload
def FlexibleServerActiveDirectoryAdministratory(resource_name: str,
                                                args: FlexibleServerActiveDirectoryAdministratoryArgs,
                                                opts: Optional[ResourceOptions] = None)

@overload
def FlexibleServerActiveDirectoryAdministratory(resource_name: str,
                                                opts: Optional[ResourceOptions] = None,
                                                identity_id: Optional[str] = None,
                                                login: Optional[str] = None,
                                                object_id: Optional[str] = None,
                                                server_id: Optional[str] = None,
                                                tenant_id: Optional[str] = None)
func NewFlexibleServerActiveDirectoryAdministratory(ctx *Context, name string, args FlexibleServerActiveDirectoryAdministratoryArgs, opts ...ResourceOption) (*FlexibleServerActiveDirectoryAdministratory, error)
public FlexibleServerActiveDirectoryAdministratory(string name, FlexibleServerActiveDirectoryAdministratoryArgs args, CustomResourceOptions? opts = null)
public FlexibleServerActiveDirectoryAdministratory(String name, FlexibleServerActiveDirectoryAdministratoryArgs args)
public FlexibleServerActiveDirectoryAdministratory(String name, FlexibleServerActiveDirectoryAdministratoryArgs args, CustomResourceOptions options)
type: azure:mysql:FlexibleServerActiveDirectoryAdministratory
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. FlexibleServerActiveDirectoryAdministratoryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. FlexibleServerActiveDirectoryAdministratoryArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. FlexibleServerActiveDirectoryAdministratoryArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. FlexibleServerActiveDirectoryAdministratoryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. FlexibleServerActiveDirectoryAdministratoryArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var flexibleServerActiveDirectoryAdministratoryResource = new Azure.MySql.FlexibleServerActiveDirectoryAdministratory("flexibleServerActiveDirectoryAdministratoryResource", new()
{
    IdentityId = "string",
    Login = "string",
    ObjectId = "string",
    ServerId = "string",
    TenantId = "string",
});
Copy
example, err := mysql.NewFlexibleServerActiveDirectoryAdministratory(ctx, "flexibleServerActiveDirectoryAdministratoryResource", &mysql.FlexibleServerActiveDirectoryAdministratoryArgs{
	IdentityId: pulumi.String("string"),
	Login:      pulumi.String("string"),
	ObjectId:   pulumi.String("string"),
	ServerId:   pulumi.String("string"),
	TenantId:   pulumi.String("string"),
})
Copy
var flexibleServerActiveDirectoryAdministratoryResource = new FlexibleServerActiveDirectoryAdministratory("flexibleServerActiveDirectoryAdministratoryResource", FlexibleServerActiveDirectoryAdministratoryArgs.builder()
    .identityId("string")
    .login("string")
    .objectId("string")
    .serverId("string")
    .tenantId("string")
    .build());
Copy
flexible_server_active_directory_administratory_resource = azure.mysql.FlexibleServerActiveDirectoryAdministratory("flexibleServerActiveDirectoryAdministratoryResource",
    identity_id="string",
    login="string",
    object_id="string",
    server_id="string",
    tenant_id="string")
Copy
const flexibleServerActiveDirectoryAdministratoryResource = new azure.mysql.FlexibleServerActiveDirectoryAdministratory("flexibleServerActiveDirectoryAdministratoryResource", {
    identityId: "string",
    login: "string",
    objectId: "string",
    serverId: "string",
    tenantId: "string",
});
Copy
type: azure:mysql:FlexibleServerActiveDirectoryAdministratory
properties:
    identityId: string
    login: string
    objectId: string
    serverId: string
    tenantId: string
Copy

FlexibleServerActiveDirectoryAdministratory Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The FlexibleServerActiveDirectoryAdministratory resource accepts the following input properties:

IdentityId This property is required. string
The resource ID of the identity used for AAD Authentication.
Login This property is required. string
The login name of the principal to set as the server administrator
ObjectId This property is required. string
The ID of the principal to set as the server administrator. For a managed identity this should be the Client ID of the identity.
ServerId
This property is required.
Changes to this property will trigger replacement.
string
The resource ID of the MySQL Flexible Server. Changing this forces a new resource to be created.
TenantId This property is required. string
The Azure Tenant ID.
IdentityId This property is required. string
The resource ID of the identity used for AAD Authentication.
Login This property is required. string
The login name of the principal to set as the server administrator
ObjectId This property is required. string
The ID of the principal to set as the server administrator. For a managed identity this should be the Client ID of the identity.
ServerId
This property is required.
Changes to this property will trigger replacement.
string
The resource ID of the MySQL Flexible Server. Changing this forces a new resource to be created.
TenantId This property is required. string
The Azure Tenant ID.
identityId This property is required. String
The resource ID of the identity used for AAD Authentication.
login This property is required. String
The login name of the principal to set as the server administrator
objectId This property is required. String
The ID of the principal to set as the server administrator. For a managed identity this should be the Client ID of the identity.
serverId
This property is required.
Changes to this property will trigger replacement.
String
The resource ID of the MySQL Flexible Server. Changing this forces a new resource to be created.
tenantId This property is required. String
The Azure Tenant ID.
identityId This property is required. string
The resource ID of the identity used for AAD Authentication.
login This property is required. string
The login name of the principal to set as the server administrator
objectId This property is required. string
The ID of the principal to set as the server administrator. For a managed identity this should be the Client ID of the identity.
serverId
This property is required.
Changes to this property will trigger replacement.
string
The resource ID of the MySQL Flexible Server. Changing this forces a new resource to be created.
tenantId This property is required. string
The Azure Tenant ID.
identity_id This property is required. str
The resource ID of the identity used for AAD Authentication.
login This property is required. str
The login name of the principal to set as the server administrator
object_id This property is required. str
The ID of the principal to set as the server administrator. For a managed identity this should be the Client ID of the identity.
server_id
This property is required.
Changes to this property will trigger replacement.
str
The resource ID of the MySQL Flexible Server. Changing this forces a new resource to be created.
tenant_id This property is required. str
The Azure Tenant ID.
identityId This property is required. String
The resource ID of the identity used for AAD Authentication.
login This property is required. String
The login name of the principal to set as the server administrator
objectId This property is required. String
The ID of the principal to set as the server administrator. For a managed identity this should be the Client ID of the identity.
serverId
This property is required.
Changes to this property will trigger replacement.
String
The resource ID of the MySQL Flexible Server. Changing this forces a new resource to be created.
tenantId This property is required. String
The Azure Tenant ID.

Outputs

All input properties are implicitly available as output properties. Additionally, the FlexibleServerActiveDirectoryAdministratory resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing FlexibleServerActiveDirectoryAdministratory Resource

Get an existing FlexibleServerActiveDirectoryAdministratory resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: FlexibleServerActiveDirectoryAdministratoryState, opts?: CustomResourceOptions): FlexibleServerActiveDirectoryAdministratory
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        identity_id: Optional[str] = None,
        login: Optional[str] = None,
        object_id: Optional[str] = None,
        server_id: Optional[str] = None,
        tenant_id: Optional[str] = None) -> FlexibleServerActiveDirectoryAdministratory
func GetFlexibleServerActiveDirectoryAdministratory(ctx *Context, name string, id IDInput, state *FlexibleServerActiveDirectoryAdministratoryState, opts ...ResourceOption) (*FlexibleServerActiveDirectoryAdministratory, error)
public static FlexibleServerActiveDirectoryAdministratory Get(string name, Input<string> id, FlexibleServerActiveDirectoryAdministratoryState? state, CustomResourceOptions? opts = null)
public static FlexibleServerActiveDirectoryAdministratory get(String name, Output<String> id, FlexibleServerActiveDirectoryAdministratoryState state, CustomResourceOptions options)
resources:  _:    type: azure:mysql:FlexibleServerActiveDirectoryAdministratory    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
IdentityId string
The resource ID of the identity used for AAD Authentication.
Login string
The login name of the principal to set as the server administrator
ObjectId string
The ID of the principal to set as the server administrator. For a managed identity this should be the Client ID of the identity.
ServerId Changes to this property will trigger replacement. string
The resource ID of the MySQL Flexible Server. Changing this forces a new resource to be created.
TenantId string
The Azure Tenant ID.
IdentityId string
The resource ID of the identity used for AAD Authentication.
Login string
The login name of the principal to set as the server administrator
ObjectId string
The ID of the principal to set as the server administrator. For a managed identity this should be the Client ID of the identity.
ServerId Changes to this property will trigger replacement. string
The resource ID of the MySQL Flexible Server. Changing this forces a new resource to be created.
TenantId string
The Azure Tenant ID.
identityId String
The resource ID of the identity used for AAD Authentication.
login String
The login name of the principal to set as the server administrator
objectId String
The ID of the principal to set as the server administrator. For a managed identity this should be the Client ID of the identity.
serverId Changes to this property will trigger replacement. String
The resource ID of the MySQL Flexible Server. Changing this forces a new resource to be created.
tenantId String
The Azure Tenant ID.
identityId string
The resource ID of the identity used for AAD Authentication.
login string
The login name of the principal to set as the server administrator
objectId string
The ID of the principal to set as the server administrator. For a managed identity this should be the Client ID of the identity.
serverId Changes to this property will trigger replacement. string
The resource ID of the MySQL Flexible Server. Changing this forces a new resource to be created.
tenantId string
The Azure Tenant ID.
identity_id str
The resource ID of the identity used for AAD Authentication.
login str
The login name of the principal to set as the server administrator
object_id str
The ID of the principal to set as the server administrator. For a managed identity this should be the Client ID of the identity.
server_id Changes to this property will trigger replacement. str
The resource ID of the MySQL Flexible Server. Changing this forces a new resource to be created.
tenant_id str
The Azure Tenant ID.
identityId String
The resource ID of the identity used for AAD Authentication.
login String
The login name of the principal to set as the server administrator
objectId String
The ID of the principal to set as the server administrator. For a managed identity this should be the Client ID of the identity.
serverId Changes to this property will trigger replacement. String
The resource ID of the MySQL Flexible Server. Changing this forces a new resource to be created.
tenantId String
The Azure Tenant ID.

Import

A MySQL Flexible Server Active Directory Administrator can be imported using the resource id, e.g.

$ pulumi import azure:mysql/flexibleServerActiveDirectoryAdministratory:FlexibleServerActiveDirectoryAdministratory example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.DBforMySQL/flexibleServers/server1/administrators/ActiveDirectory
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.