# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities

__all__ = ['ManagedInstanceActiveDirectoryAdministratorArgs', 'ManagedInstanceActiveDirectoryAdministrator']

@pulumi.input_type
class ManagedInstanceActiveDirectoryAdministratorArgs:
    def __init__(__self__, *,
                 login: pulumi.Input[str],
                 managed_instance_name: pulumi.Input[str],
                 object_id: pulumi.Input[str],
                 resource_group_name: pulumi.Input[str],
                 tenant_id: pulumi.Input[str],
                 azuread_authentication_only: Optional[pulumi.Input[bool]] = None):
        """
        The set of arguments for constructing a ManagedInstanceActiveDirectoryAdministrator resource.
        :param pulumi.Input[str] login: The login name of the principal to set as the Managed Instance administrator
        :param pulumi.Input[str] managed_instance_name: The name of the SQL Managed Instance on which to set the administrator. Changing this forces a new resource to be created.
        :param pulumi.Input[str] object_id: The ID of the principal to set as the Managed Instance administrator
        :param pulumi.Input[str] resource_group_name: The name of the resource group for the SQL Managed Instance. Changing this forces a new resource to be created.
        :param pulumi.Input[str] tenant_id: The Azure Tenant ID
        :param pulumi.Input[bool] azuread_authentication_only: Specifies whether only AD Users and administrators can be used to login (`true`) or also local database users (`false`). Defaults to `false`.
        """
        pulumi.set(__self__, "login", login)
        pulumi.set(__self__, "managed_instance_name", managed_instance_name)
        pulumi.set(__self__, "object_id", object_id)
        pulumi.set(__self__, "resource_group_name", resource_group_name)
        pulumi.set(__self__, "tenant_id", tenant_id)
        if azuread_authentication_only is not None:
            pulumi.set(__self__, "azuread_authentication_only", azuread_authentication_only)

    @property
    @pulumi.getter
    def login(self) -> pulumi.Input[str]:
        """
        The login name of the principal to set as the Managed Instance administrator
        """
        return pulumi.get(self, "login")

    @login.setter
    def login(self, value: pulumi.Input[str]):
        pulumi.set(self, "login", value)

    @property
    @pulumi.getter(name="managedInstanceName")
    def managed_instance_name(self) -> pulumi.Input[str]:
        """
        The name of the SQL Managed Instance on which to set the administrator. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "managed_instance_name")

    @managed_instance_name.setter
    def managed_instance_name(self, value: pulumi.Input[str]):
        pulumi.set(self, "managed_instance_name", value)

    @property
    @pulumi.getter(name="objectId")
    def object_id(self) -> pulumi.Input[str]:
        """
        The ID of the principal to set as the Managed Instance administrator
        """
        return pulumi.get(self, "object_id")

    @object_id.setter
    def object_id(self, value: pulumi.Input[str]):
        pulumi.set(self, "object_id", value)

    @property
    @pulumi.getter(name="resourceGroupName")
    def resource_group_name(self) -> pulumi.Input[str]:
        """
        The name of the resource group for the SQL Managed Instance. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "resource_group_name")

    @resource_group_name.setter
    def resource_group_name(self, value: pulumi.Input[str]):
        pulumi.set(self, "resource_group_name", value)

    @property
    @pulumi.getter(name="tenantId")
    def tenant_id(self) -> pulumi.Input[str]:
        """
        The Azure Tenant ID
        """
        return pulumi.get(self, "tenant_id")

    @tenant_id.setter
    def tenant_id(self, value: pulumi.Input[str]):
        pulumi.set(self, "tenant_id", value)

    @property
    @pulumi.getter(name="azureadAuthenticationOnly")
    def azuread_authentication_only(self) -> Optional[pulumi.Input[bool]]:
        """
        Specifies whether only AD Users and administrators can be used to login (`true`) or also local database users (`false`). Defaults to `false`.
        """
        return pulumi.get(self, "azuread_authentication_only")

    @azuread_authentication_only.setter
    def azuread_authentication_only(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "azuread_authentication_only", value)


@pulumi.input_type
class _ManagedInstanceActiveDirectoryAdministratorState:
    def __init__(__self__, *,
                 azuread_authentication_only: Optional[pulumi.Input[bool]] = None,
                 login: Optional[pulumi.Input[str]] = None,
                 managed_instance_name: Optional[pulumi.Input[str]] = None,
                 object_id: Optional[pulumi.Input[str]] = None,
                 resource_group_name: Optional[pulumi.Input[str]] = None,
                 tenant_id: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering ManagedInstanceActiveDirectoryAdministrator resources.
        :param pulumi.Input[bool] azuread_authentication_only: Specifies whether only AD Users and administrators can be used to login (`true`) or also local database users (`false`). Defaults to `false`.
        :param pulumi.Input[str] login: The login name of the principal to set as the Managed Instance administrator
        :param pulumi.Input[str] managed_instance_name: The name of the SQL Managed Instance on which to set the administrator. Changing this forces a new resource to be created.
        :param pulumi.Input[str] object_id: The ID of the principal to set as the Managed Instance administrator
        :param pulumi.Input[str] resource_group_name: The name of the resource group for the SQL Managed Instance. Changing this forces a new resource to be created.
        :param pulumi.Input[str] tenant_id: The Azure Tenant ID
        """
        if azuread_authentication_only is not None:
            pulumi.set(__self__, "azuread_authentication_only", azuread_authentication_only)
        if login is not None:
            pulumi.set(__self__, "login", login)
        if managed_instance_name is not None:
            pulumi.set(__self__, "managed_instance_name", managed_instance_name)
        if object_id is not None:
            pulumi.set(__self__, "object_id", object_id)
        if resource_group_name is not None:
            pulumi.set(__self__, "resource_group_name", resource_group_name)
        if tenant_id is not None:
            pulumi.set(__self__, "tenant_id", tenant_id)

    @property
    @pulumi.getter(name="azureadAuthenticationOnly")
    def azuread_authentication_only(self) -> Optional[pulumi.Input[bool]]:
        """
        Specifies whether only AD Users and administrators can be used to login (`true`) or also local database users (`false`). Defaults to `false`.
        """
        return pulumi.get(self, "azuread_authentication_only")

    @azuread_authentication_only.setter
    def azuread_authentication_only(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "azuread_authentication_only", value)

    @property
    @pulumi.getter
    def login(self) -> Optional[pulumi.Input[str]]:
        """
        The login name of the principal to set as the Managed Instance administrator
        """
        return pulumi.get(self, "login")

    @login.setter
    def login(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "login", value)

    @property
    @pulumi.getter(name="managedInstanceName")
    def managed_instance_name(self) -> Optional[pulumi.Input[str]]:
        """
        The name of the SQL Managed Instance on which to set the administrator. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "managed_instance_name")

    @managed_instance_name.setter
    def managed_instance_name(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "managed_instance_name", value)

    @property
    @pulumi.getter(name="objectId")
    def object_id(self) -> Optional[pulumi.Input[str]]:
        """
        The ID of the principal to set as the Managed Instance administrator
        """
        return pulumi.get(self, "object_id")

    @object_id.setter
    def object_id(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "object_id", value)

    @property
    @pulumi.getter(name="resourceGroupName")
    def resource_group_name(self) -> Optional[pulumi.Input[str]]:
        """
        The name of the resource group for the SQL Managed Instance. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "resource_group_name")

    @resource_group_name.setter
    def resource_group_name(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "resource_group_name", value)

    @property
    @pulumi.getter(name="tenantId")
    def tenant_id(self) -> Optional[pulumi.Input[str]]:
        """
        The Azure Tenant ID
        """
        return pulumi.get(self, "tenant_id")

    @tenant_id.setter
    def tenant_id(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "tenant_id", value)


class ManagedInstanceActiveDirectoryAdministrator(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 azuread_authentication_only: Optional[pulumi.Input[bool]] = None,
                 login: Optional[pulumi.Input[str]] = None,
                 managed_instance_name: Optional[pulumi.Input[str]] = None,
                 object_id: Optional[pulumi.Input[str]] = None,
                 resource_group_name: Optional[pulumi.Input[str]] = None,
                 tenant_id: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Allows you to set a user or group as the AD administrator for an Azure SQL Managed Instance

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        example_managed_instance = azure.sql.ManagedInstance("exampleManagedInstance",
            resource_group_name=azurerm_resource_group["example"]["name"],
            location=azurerm_resource_group["example"]["location"],
            administrator_login="mradministrator",
            administrator_login_password="thisIsDog11",
            license_type="BasePrice",
            subnet_id=azurerm_subnet["example"]["id"],
            sku_name="GP_Gen5",
            vcores=4,
            storage_size_in_gb=32,
            opts=pulumi.ResourceOptions(depends_on=[
                    azurerm_subnet_network_security_group_association["example"],
                    azurerm_subnet_route_table_association["example"],
                ]))
        current = azure.core.get_client_config()
        example_managed_instance_active_directory_administrator = azure.sql.ManagedInstanceActiveDirectoryAdministrator("exampleManagedInstanceActiveDirectoryAdministrator",
            managed_instance_name=example_managed_instance.name,
            resource_group_name=azurerm_resource_group["example"]["name"],
            login="sqladmin",
            tenant_id=current.tenant_id,
            object_id=current.object_id)
        ```

        ## 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
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[bool] azuread_authentication_only: Specifies whether only AD Users and administrators can be used to login (`true`) or also local database users (`false`). Defaults to `false`.
        :param pulumi.Input[str] login: The login name of the principal to set as the Managed Instance administrator
        :param pulumi.Input[str] managed_instance_name: The name of the SQL Managed Instance on which to set the administrator. Changing this forces a new resource to be created.
        :param pulumi.Input[str] object_id: The ID of the principal to set as the Managed Instance administrator
        :param pulumi.Input[str] resource_group_name: The name of the resource group for the SQL Managed Instance. Changing this forces a new resource to be created.
        :param pulumi.Input[str] tenant_id: The Azure Tenant ID
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: ManagedInstanceActiveDirectoryAdministratorArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Allows you to set a user or group as the AD administrator for an Azure SQL Managed Instance

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        example_managed_instance = azure.sql.ManagedInstance("exampleManagedInstance",
            resource_group_name=azurerm_resource_group["example"]["name"],
            location=azurerm_resource_group["example"]["location"],
            administrator_login="mradministrator",
            administrator_login_password="thisIsDog11",
            license_type="BasePrice",
            subnet_id=azurerm_subnet["example"]["id"],
            sku_name="GP_Gen5",
            vcores=4,
            storage_size_in_gb=32,
            opts=pulumi.ResourceOptions(depends_on=[
                    azurerm_subnet_network_security_group_association["example"],
                    azurerm_subnet_route_table_association["example"],
                ]))
        current = azure.core.get_client_config()
        example_managed_instance_active_directory_administrator = azure.sql.ManagedInstanceActiveDirectoryAdministrator("exampleManagedInstanceActiveDirectoryAdministrator",
            managed_instance_name=example_managed_instance.name,
            resource_group_name=azurerm_resource_group["example"]["name"],
            login="sqladmin",
            tenant_id=current.tenant_id,
            object_id=current.object_id)
        ```

        ## 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
        ```

        :param str resource_name: The name of the resource.
        :param ManagedInstanceActiveDirectoryAdministratorArgs args: The arguments to use to populate this resource's properties.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        ...
    def __init__(__self__, resource_name: str, *args, **kwargs):
        resource_args, opts = _utilities.get_resource_args_opts(ManagedInstanceActiveDirectoryAdministratorArgs, pulumi.ResourceOptions, *args, **kwargs)
        if resource_args is not None:
            __self__._internal_init(resource_name, opts, **resource_args.__dict__)
        else:
            __self__._internal_init(resource_name, *args, **kwargs)

    def _internal_init(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 azuread_authentication_only: Optional[pulumi.Input[bool]] = None,
                 login: Optional[pulumi.Input[str]] = None,
                 managed_instance_name: Optional[pulumi.Input[str]] = None,
                 object_id: Optional[pulumi.Input[str]] = None,
                 resource_group_name: Optional[pulumi.Input[str]] = None,
                 tenant_id: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = _utilities.get_version()
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = ManagedInstanceActiveDirectoryAdministratorArgs.__new__(ManagedInstanceActiveDirectoryAdministratorArgs)

            __props__.__dict__["azuread_authentication_only"] = azuread_authentication_only
            if login is None and not opts.urn:
                raise TypeError("Missing required property 'login'")
            __props__.__dict__["login"] = login
            if managed_instance_name is None and not opts.urn:
                raise TypeError("Missing required property 'managed_instance_name'")
            __props__.__dict__["managed_instance_name"] = managed_instance_name
            if object_id is None and not opts.urn:
                raise TypeError("Missing required property 'object_id'")
            __props__.__dict__["object_id"] = object_id
            if resource_group_name is None and not opts.urn:
                raise TypeError("Missing required property 'resource_group_name'")
            __props__.__dict__["resource_group_name"] = resource_group_name
            if tenant_id is None and not opts.urn:
                raise TypeError("Missing required property 'tenant_id'")
            __props__.__dict__["tenant_id"] = tenant_id
        super(ManagedInstanceActiveDirectoryAdministrator, __self__).__init__(
            'azure:sql/managedInstanceActiveDirectoryAdministrator:ManagedInstanceActiveDirectoryAdministrator',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            azuread_authentication_only: Optional[pulumi.Input[bool]] = None,
            login: Optional[pulumi.Input[str]] = None,
            managed_instance_name: Optional[pulumi.Input[str]] = None,
            object_id: Optional[pulumi.Input[str]] = None,
            resource_group_name: Optional[pulumi.Input[str]] = None,
            tenant_id: Optional[pulumi.Input[str]] = None) -> 'ManagedInstanceActiveDirectoryAdministrator':
        """
        Get an existing ManagedInstanceActiveDirectoryAdministrator resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[bool] azuread_authentication_only: Specifies whether only AD Users and administrators can be used to login (`true`) or also local database users (`false`). Defaults to `false`.
        :param pulumi.Input[str] login: The login name of the principal to set as the Managed Instance administrator
        :param pulumi.Input[str] managed_instance_name: The name of the SQL Managed Instance on which to set the administrator. Changing this forces a new resource to be created.
        :param pulumi.Input[str] object_id: The ID of the principal to set as the Managed Instance administrator
        :param pulumi.Input[str] resource_group_name: The name of the resource group for the SQL Managed Instance. Changing this forces a new resource to be created.
        :param pulumi.Input[str] tenant_id: The Azure Tenant ID
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _ManagedInstanceActiveDirectoryAdministratorState.__new__(_ManagedInstanceActiveDirectoryAdministratorState)

        __props__.__dict__["azuread_authentication_only"] = azuread_authentication_only
        __props__.__dict__["login"] = login
        __props__.__dict__["managed_instance_name"] = managed_instance_name
        __props__.__dict__["object_id"] = object_id
        __props__.__dict__["resource_group_name"] = resource_group_name
        __props__.__dict__["tenant_id"] = tenant_id
        return ManagedInstanceActiveDirectoryAdministrator(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="azureadAuthenticationOnly")
    def azuread_authentication_only(self) -> pulumi.Output[Optional[bool]]:
        """
        Specifies whether only AD Users and administrators can be used to login (`true`) or also local database users (`false`). Defaults to `false`.
        """
        return pulumi.get(self, "azuread_authentication_only")

    @property
    @pulumi.getter
    def login(self) -> pulumi.Output[str]:
        """
        The login name of the principal to set as the Managed Instance administrator
        """
        return pulumi.get(self, "login")

    @property
    @pulumi.getter(name="managedInstanceName")
    def managed_instance_name(self) -> pulumi.Output[str]:
        """
        The name of the SQL Managed Instance on which to set the administrator. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "managed_instance_name")

    @property
    @pulumi.getter(name="objectId")
    def object_id(self) -> pulumi.Output[str]:
        """
        The ID of the principal to set as the Managed Instance administrator
        """
        return pulumi.get(self, "object_id")

    @property
    @pulumi.getter(name="resourceGroupName")
    def resource_group_name(self) -> pulumi.Output[str]:
        """
        The name of the resource group for the SQL Managed Instance. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "resource_group_name")

    @property
    @pulumi.getter(name="tenantId")
    def tenant_id(self) -> pulumi.Output[str]:
        """
        The Azure Tenant ID
        """
        return pulumi.get(self, "tenant_id")

