Skip to content

create_microsoft_ad async

create_microsoft_ad(
    name: DirectoryName,
    password: Password,
    vpc_settings: DirectoryVpcSettings,
    *,
    config_overrides: Optional[AsyncDirectoryServiceClientConfig] = None,
    short_name: Optional[DirectoryShortName] = None,
    description: Optional[Description] = None,
    edition: Optional[DirectoryEdition] = None,
    tags: Optional[Tags] = None,
    network_type: Optional[NetworkType] = None,
) -> CreateMicrosoftADResult

Creates a Microsoft AD directory in the Amazon Web Services Cloud. For more information, see Managed Microsoft AD in the Directory Service Admin Guide.

Before you call CreateMicrosoftAD, ensure that all of the required permissions have been explicitly granted through a policy. For details about what permissions are required to run the CreateMicrosoftAD operation, see Directory Service API Permissions: Actions, Resources, and Conditions Reference.

Parameters:

  • name (DirectoryName) –

    The fully qualified domain name for the Managed Microsoft AD directory, such as corp.example.com. This name will resolve inside your VPC only. It does not need to be publicly resolvable.

  • short_name (Optional[DirectoryShortName], default: None ) –

    The NetBIOS name for your domain, such as CORP. If you don't specify a NetBIOS name, it will default to the first part of your directory DNS. For example, CORP for the directory DNS corp.example.com.

  • password (Password) –

    The password for the default administrative user named Admin.

    If you need to change the password for the administrator account, you can use the ResetUserPassword API call.

  • description (Optional[Description], default: None ) –

    A description for the directory. This label will appear on the Amazon Web Services console Directory Details page after the directory is created.

  • vpc_settings (DirectoryVpcSettings) –

    Contains VPC information for the CreateDirectory or CreateMicrosoftAD operation.

  • edition (Optional[DirectoryEdition], default: None ) –

    Managed Microsoft AD is available in two editions: Standard and Enterprise. Enterprise is the default.

  • tags (Optional[Tags], default: None ) –

    The tags to be assigned to the Managed Microsoft AD directory.

  • network_type (Optional[NetworkType], default: None ) –

    The network type for your domain. The default value is IPv4 or IPv6 based on the provided subnet capabilities.

Raises:

Examples:

To create a Microsoft AD directory The following example creates a Microsoft AD directory in the AWS cloud.

>>> await client.create_microsoft_ad(name='ad.example.com', short_name='ad', password='Str0ngP@ssw0rd', description='Corporate AD directory', vpc_settings={'SubnetIds': ['subnet-ba0146de', 'subnet-bef46bc8'], 'VpcId': 'vpc-45025421'})
Source code in docs_src/capo_directory_service/_services/async_directory_service.py
async def create_microsoft_ad(
    self,
    name: "capo_directory_service.types.directory_name.DirectoryName",
    password: "capo_directory_service.types.password.Password",
    vpc_settings: "capo_directory_service.types.directory_vpc_settings.DirectoryVpcSettings",
    *,
    config_overrides: Optional[AsyncDirectoryServiceClientConfig] = None,
    short_name: Optional[
        "capo_directory_service.types.directory_short_name.DirectoryShortName"
    ] = None,
    description: Optional[
        "capo_directory_service.types.description.Description"
    ] = None,
    edition: Optional[
        "capo_directory_service.types.directory_edition.DirectoryEdition"
    ] = None,
    tags: Optional["capo_directory_service.types.tags.Tags"] = None,
    network_type: Optional[
        "capo_directory_service.types.network_type.NetworkType"
    ] = None,
) -> "capo_directory_service.types.create_microsoft_ad_result.CreateMicrosoftADResult":
    """<p>Creates a Microsoft AD directory in the Amazon Web Services Cloud. For more information, see <a href="https://docs.aws.amazon.com/directoryservice/latest/admin-guide/directory_microsoft_ad.html">Managed Microsoft AD</a> in the <i>Directory Service Admin Guide</i>.</p> <p>Before you call <i>CreateMicrosoftAD</i>, ensure that all of the required permissions have been explicitly granted through a policy. For details about what permissions are required to run the <i>CreateMicrosoftAD</i> operation, see <a href="http://docs.aws.amazon.com/directoryservice/latest/admin-guide/UsingWithDS_IAM_ResourcePermissions.html">Directory Service API Permissions: Actions, Resources, and Conditions Reference</a>.</p>

    Args:
        name: <p>The fully qualified domain name for the Managed Microsoft AD directory, such as <code>corp.example.com</code>. This name will resolve inside your VPC only. It does not need to be publicly resolvable.</p>
        short_name: <p>The NetBIOS name for your domain, such as <code>CORP</code>. If you don't specify a NetBIOS name, it will default to the first part of your directory DNS. For example, <code>CORP</code> for the directory DNS <code>corp.example.com</code>. </p>
        password: <p>The password for the default administrative user named <code>Admin</code>.</p> <p>If you need to change the password for the administrator account, you can use the <a>ResetUserPassword</a> API call.</p>
        description: <p>A description for the directory. This label will appear on the Amazon Web Services console <code>Directory Details</code> page after the directory is created.</p>
        vpc_settings: <p>Contains VPC information for the <a>CreateDirectory</a> or <a>CreateMicrosoftAD</a> operation.</p>
        edition: <p>Managed Microsoft AD is available in two editions: <code>Standard</code> and <code>Enterprise</code>. <code>Enterprise</code> is the default.</p>
        tags: <p>The tags to be assigned to the Managed Microsoft AD directory.</p>
        network_type: <p> The network type for your domain. The default value is <code>IPv4</code> or <code>IPv6</code> based on the provided subnet capabilities.</p>

    Raises:
        capo_directory_service.errors.client_exception.ClientException: <p>A client exception has occurred.</p>
        capo_directory_service.errors.directory_limit_exceeded_exception.DirectoryLimitExceededException: <p>The maximum number of directories in the region has been reached. You can use the <a>GetDirectoryLimits</a> operation to determine your directory limits in the region.</p>
        capo_directory_service.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more parameters are not valid.</p>
        capo_directory_service.errors.service_exception.ServiceException: <p>An exception has occurred in Directory Service.</p>
        capo_directory_service.errors.unsupported_operation_exception.UnsupportedOperationException: <p>The operation is not supported.</p>
        capo_directory_service.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create a Microsoft AD directory
        The following example creates a Microsoft AD directory in the AWS cloud.

        >>> await client.create_microsoft_ad(name='ad.example.com', short_name='ad', password='Str0ngP@ssw0rd', description='Corporate AD directory', vpc_settings={'SubnetIds': ['subnet-ba0146de', 'subnet-bef46bc8'], 'VpcId': 'vpc-45025421'})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_directory_service.types.create_microsoft_ad_request.CreateMicrosoftADRequest]",
    ) -> AsyncOperationResponse[
        "capo_directory_service.types.create_microsoft_ad_result.CreateMicrosoftADResult"
    ]:
        import capo_directory_service._operations.directory_service_20150416.create_microsoft_ad

        (
            output,
            http_response,
        ) = await capo_directory_service._operations.directory_service_20150416.create_microsoft_ad.async_create_microsoft_ad(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_directory_service.types.create_microsoft_ad_request.CreateMicrosoftADRequest",
    ) -> dict[str, Any]:
        import capo_directory_service.types.create_microsoft_ad_request

        return capo_directory_service.types.create_microsoft_ad_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateMicrosoftAD", redact_input=_redact_input),
    )
    input_: capo_directory_service.types.create_microsoft_ad_request.CreateMicrosoftADRequest = {
        "name": name,
        "password": password,
        "vpc_settings": vpc_settings,
    }
    if short_name is not None:
        input_["short_name"] = short_name
    if description is not None:
        input_["description"] = description
    if edition is not None:
        input_["edition"] = edition
    if tags is not None:
        input_["tags"] = tags
    if network_type is not None:
        input_["network_type"] = network_type

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output