All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.sql.kotlin.ManagedInstanceActiveDirectoryAdministratorArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.sql.kotlin

import com.pulumi.azure.sql.ManagedInstanceActiveDirectoryAdministratorArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Allows you to set a user or group as the AD administrator for an Azure SQL Managed Instance.
 * > **Note:** The `azure.sql.ManagedInstanceActiveDirectoryAdministrator` resource is deprecated in version 3.0 of the AzureRM provider and will be removed in version 4.0. Please use the `azure.mssql.ManagedInstanceActiveDirectoryAdministrator` resource instead.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "rg-example",
 *     location: "West Europe",
 * });
 * const exampleManagedInstance = new azure.sql.ManagedInstance("example", {
 *     name: "managedsqlinstance",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     administratorLogin: "mradministrator",
 *     administratorLoginPassword: "thisIsDog11",
 *     licenseType: "BasePrice",
 *     subnetId: exampleAzurermSubnet.id,
 *     skuName: "GP_Gen5",
 *     vcores: 4,
 *     storageSizeInGb: 32,
 * }, {
 *     dependsOn: [
 *         exampleAzurermSubnetNetworkSecurityGroupAssociation,
 *         exampleAzurermSubnetRouteTableAssociation,
 *     ],
 * });
 * const current = azure.core.getClientConfig({});
 * const exampleManagedInstanceActiveDirectoryAdministrator = new azure.sql.ManagedInstanceActiveDirectoryAdministrator("example", {
 *     managedInstanceName: exampleManagedInstance.name,
 *     resourceGroupName: example.name,
 *     login: "sqladmin",
 *     tenantId: current.then(current => current.tenantId),
 *     objectId: current.then(current => current.objectId),
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="rg-example",
 *     location="West Europe")
 * example_managed_instance = azure.sql.ManagedInstance("example",
 *     name="managedsqlinstance",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     administrator_login="mradministrator",
 *     administrator_login_password="thisIsDog11",
 *     license_type="BasePrice",
 *     subnet_id=example_azurerm_subnet["id"],
 *     sku_name="GP_Gen5",
 *     vcores=4,
 *     storage_size_in_gb=32,
 *     opts = pulumi.ResourceOptions(depends_on=[
 *             example_azurerm_subnet_network_security_group_association,
 *             example_azurerm_subnet_route_table_association,
 *         ]))
 * current = azure.core.get_client_config()
 * example_managed_instance_active_directory_administrator = azure.sql.ManagedInstanceActiveDirectoryAdministrator("example",
 *     managed_instance_name=example_managed_instance.name,
 *     resource_group_name=example.name,
 *     login="sqladmin",
 *     tenant_id=current.tenant_id,
 *     object_id=current.object_id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "rg-example",
 *         Location = "West Europe",
 *     });
 *     var exampleManagedInstance = new Azure.Sql.ManagedInstance("example", new()
 *     {
 *         Name = "managedsqlinstance",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AdministratorLogin = "mradministrator",
 *         AdministratorLoginPassword = "thisIsDog11",
 *         LicenseType = "BasePrice",
 *         SubnetId = exampleAzurermSubnet.Id,
 *         SkuName = "GP_Gen5",
 *         Vcores = 4,
 *         StorageSizeInGb = 32,
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             exampleAzurermSubnetNetworkSecurityGroupAssociation,
 *             exampleAzurermSubnetRouteTableAssociation,
 *         },
 *     });
 *     var current = Azure.Core.GetClientConfig.Invoke();
 *     var exampleManagedInstanceActiveDirectoryAdministrator = new Azure.Sql.ManagedInstanceActiveDirectoryAdministrator("example", new()
 *     {
 *         ManagedInstanceName = exampleManagedInstance.Name,
 *         ResourceGroupName = example.Name,
 *         Login = "sqladmin",
 *         TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
 *         ObjectId = current.Apply(getClientConfigResult => getClientConfigResult.ObjectId),
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/sql"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("rg-example"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleManagedInstance, err := sql.NewManagedInstance(ctx, "example", &sql.ManagedInstanceArgs{
 * 			Name:                       pulumi.String("managedsqlinstance"),
 * 			ResourceGroupName:          example.Name,
 * 			Location:                   example.Location,
 * 			AdministratorLogin:         pulumi.String("mradministrator"),
 * 			AdministratorLoginPassword: pulumi.String("thisIsDog11"),
 * 			LicenseType:                pulumi.String("BasePrice"),
 * 			SubnetId:                   pulumi.Any(exampleAzurermSubnet.Id),
 * 			SkuName:                    pulumi.String("GP_Gen5"),
 * 			Vcores:                     pulumi.Int(4),
 * 			StorageSizeInGb:            pulumi.Int(32),
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			exampleAzurermSubnetNetworkSecurityGroupAssociation,
 * 			exampleAzurermSubnetRouteTableAssociation,
 * 		}))
 * 		if err != nil {
 * 			return err
 * 		}
 * 		current, err := core.GetClientConfig(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = sql.NewManagedInstanceActiveDirectoryAdministrator(ctx, "example", &sql.ManagedInstanceActiveDirectoryAdministratorArgs{
 * 			ManagedInstanceName: exampleManagedInstance.Name,
 * 			ResourceGroupName:   example.Name,
 * 			Login:               pulumi.String("sqladmin"),
 * 			TenantId:            pulumi.String(current.TenantId),
 * 			ObjectId:            pulumi.String(current.ObjectId),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.sql.ManagedInstance;
 * import com.pulumi.azure.sql.ManagedInstanceArgs;
 * import com.pulumi.azure.core.CoreFunctions;
 * import com.pulumi.azure.sql.ManagedInstanceActiveDirectoryAdministrator;
 * import com.pulumi.azure.sql.ManagedInstanceActiveDirectoryAdministratorArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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) {
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("rg-example")
 *             .location("West Europe")
 *             .build());
 *         var exampleManagedInstance = new ManagedInstance("exampleManagedInstance", ManagedInstanceArgs.builder()
 *             .name("managedsqlinstance")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .administratorLogin("mradministrator")
 *             .administratorLoginPassword("thisIsDog11")
 *             .licenseType("BasePrice")
 *             .subnetId(exampleAzurermSubnet.id())
 *             .skuName("GP_Gen5")
 *             .vcores(4)
 *             .storageSizeInGb(32)
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(
 *                     exampleAzurermSubnetNetworkSecurityGroupAssociation,
 *                     exampleAzurermSubnetRouteTableAssociation)
 *                 .build());
 *         final var current = CoreFunctions.getClientConfig();
 *         var exampleManagedInstanceActiveDirectoryAdministrator = new ManagedInstanceActiveDirectoryAdministrator("exampleManagedInstanceActiveDirectoryAdministrator", ManagedInstanceActiveDirectoryAdministratorArgs.builder()
 *             .managedInstanceName(exampleManagedInstance.name())
 *             .resourceGroupName(example.name())
 *             .login("sqladmin")
 *             .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *             .objectId(current.applyValue(getClientConfigResult -> getClientConfigResult.objectId()))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: rg-example
 *       location: West Europe
 *   exampleManagedInstance:
 *     type: azure:sql:ManagedInstance
 *     name: example
 *     properties:
 *       name: managedsqlinstance
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       administratorLogin: mradministrator
 *       administratorLoginPassword: thisIsDog11
 *       licenseType: BasePrice
 *       subnetId: ${exampleAzurermSubnet.id}
 *       skuName: GP_Gen5
 *       vcores: 4
 *       storageSizeInGb: 32
 *     options:
 *       dependson:
 *         - ${exampleAzurermSubnetNetworkSecurityGroupAssociation}
 *         - ${exampleAzurermSubnetRouteTableAssociation}
 *   exampleManagedInstanceActiveDirectoryAdministrator:
 *     type: azure:sql:ManagedInstanceActiveDirectoryAdministrator
 *     name: example
 *     properties:
 *       managedInstanceName: ${exampleManagedInstance.name}
 *       resourceGroupName: ${example.name}
 *       login: sqladmin
 *       tenantId: ${current.tenantId}
 *       objectId: ${current.objectId}
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: azure:core:getClientConfig
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * A SQL Active Directory Administrator can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:sql/managedInstanceActiveDirectoryAdministrator:ManagedInstanceActiveDirectoryAdministrator administrator /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myresourcegroup/providers/Microsoft.Sql/managedInstances/mymanagedinstance/administrators/activeDirectory
 * ```
 * @property azureadAuthenticationOnly Specifies whether only AD Users and administrators can be used to login (`true`) or also local database users (`false`). Defaults to `false`.
 * @property login The login name of the principal to set as the Managed Instance administrator
 * @property managedInstanceName The name of the SQL Managed Instance on which to set the administrator. Changing this forces a new resource to be created.
 * @property objectId The ID of the principal to set as the Managed Instance administrator
 * @property resourceGroupName The name of the resource group for the SQL Managed Instance. Changing this forces a new resource to be created.
 * @property tenantId The Azure Tenant ID
 */
public data class ManagedInstanceActiveDirectoryAdministratorArgs(
    public val azureadAuthenticationOnly: Output? = null,
    public val login: Output? = null,
    public val managedInstanceName: Output? = null,
    public val objectId: Output? = null,
    public val resourceGroupName: Output? = null,
    public val tenantId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.sql.ManagedInstanceActiveDirectoryAdministratorArgs =
        com.pulumi.azure.sql.ManagedInstanceActiveDirectoryAdministratorArgs.builder()
            .azureadAuthenticationOnly(azureadAuthenticationOnly?.applyValue({ args0 -> args0 }))
            .login(login?.applyValue({ args0 -> args0 }))
            .managedInstanceName(managedInstanceName?.applyValue({ args0 -> args0 }))
            .objectId(objectId?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .tenantId(tenantId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [ManagedInstanceActiveDirectoryAdministratorArgs].
 */
@PulumiTagMarker
public class ManagedInstanceActiveDirectoryAdministratorArgsBuilder internal constructor() {
    private var azureadAuthenticationOnly: Output? = null

    private var login: Output? = null

    private var managedInstanceName: Output? = null

    private var objectId: Output? = null

    private var resourceGroupName: Output? = null

    private var tenantId: Output? = null

    /**
     * @param value Specifies whether only AD Users and administrators can be used to login (`true`) or also local database users (`false`). Defaults to `false`.
     */
    @JvmName("ikhjpvifpklyqrok")
    public suspend fun azureadAuthenticationOnly(`value`: Output) {
        this.azureadAuthenticationOnly = value
    }

    /**
     * @param value The login name of the principal to set as the Managed Instance administrator
     */
    @JvmName("hoogpigcqctqqykq")
    public suspend fun login(`value`: Output) {
        this.login = value
    }

    /**
     * @param value The name of the SQL Managed Instance on which to set the administrator. Changing this forces a new resource to be created.
     */
    @JvmName("mcmcrhalmukeqvwk")
    public suspend fun managedInstanceName(`value`: Output) {
        this.managedInstanceName = value
    }

    /**
     * @param value The ID of the principal to set as the Managed Instance administrator
     */
    @JvmName("tgiqkdgssqlhyltr")
    public suspend fun objectId(`value`: Output) {
        this.objectId = value
    }

    /**
     * @param value The name of the resource group for the SQL Managed Instance. Changing this forces a new resource to be created.
     */
    @JvmName("ugfeiwnydajnpxqh")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value The Azure Tenant ID
     */
    @JvmName("neiqnxkbjnsmdikf")
    public suspend fun tenantId(`value`: Output) {
        this.tenantId = value
    }

    /**
     * @param value Specifies whether only AD Users and administrators can be used to login (`true`) or also local database users (`false`). Defaults to `false`.
     */
    @JvmName("gwsebugybyxjbjua")
    public suspend fun azureadAuthenticationOnly(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.azureadAuthenticationOnly = mapped
    }

    /**
     * @param value The login name of the principal to set as the Managed Instance administrator
     */
    @JvmName("qcwvchrqkcopnabq")
    public suspend fun login(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.login = mapped
    }

    /**
     * @param value The name of the SQL Managed Instance on which to set the administrator. Changing this forces a new resource to be created.
     */
    @JvmName("bxcqokijrnehjfkp")
    public suspend fun managedInstanceName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.managedInstanceName = mapped
    }

    /**
     * @param value The ID of the principal to set as the Managed Instance administrator
     */
    @JvmName("pvnbcwucjqxwtuvp")
    public suspend fun objectId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.objectId = mapped
    }

    /**
     * @param value The name of the resource group for the SQL Managed Instance. Changing this forces a new resource to be created.
     */
    @JvmName("odwwndjvtkdkfeej")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value The Azure Tenant ID
     */
    @JvmName("fikjpspbhuqxpydm")
    public suspend fun tenantId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tenantId = mapped
    }

    internal fun build(): ManagedInstanceActiveDirectoryAdministratorArgs =
        ManagedInstanceActiveDirectoryAdministratorArgs(
            azureadAuthenticationOnly = azureadAuthenticationOnly,
            login = login,
            managedInstanceName = managedInstanceName,
            objectId = objectId,
            resourceGroupName = resourceGroupName,
            tenantId = tenantId,
        )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy