Skip to content

create_trust

create_trust(
    directory_id: DirectoryId,
    remote_domain_name: RemoteDomainName,
    trust_password: TrustPassword,
    trust_direction: TrustDirection,
    *,
    config_overrides: Optional[DirectoryServiceClientConfig] = None,
    trust_type: Optional[TrustType] = None,
    conditional_forwarder_ip_addrs: Optional[DnsIpAddrs] = None,
    conditional_forwarder_ipv6_addrs: Optional[DnsIpv6Addrs] = None,
    selective_auth: Optional[SelectiveAuth] = None,
) -> CreateTrustResult

Directory Service for Microsoft Active Directory allows you to configure trust relationships. For example, you can establish a trust between your Managed Microsoft AD directory, and your existing self-managed Microsoft Active Directory. This would allow you to provide users and groups access to resources in either domain, with a single set of credentials.

This action initiates the creation of the Amazon Web Services side of a trust relationship between an Managed Microsoft AD directory and an external domain. You can create either a forest trust or an external trust.

Parameters:

  • directory_id (DirectoryId) –

    The Directory ID of the Managed Microsoft AD directory for which to establish the trust relationship.

  • remote_domain_name (RemoteDomainName) –

    The Fully Qualified Domain Name (FQDN) of the external domain for which to create the trust relationship.

  • trust_password (TrustPassword) –

    The trust password. The trust password must be the same password that was used when creating the trust relationship on the external domain.

  • trust_direction (TrustDirection) –

    The direction of the trust relationship.

  • trust_type (Optional[TrustType], default: None ) –

    The trust relationship type. Forest is the default.

  • conditional_forwarder_ip_addrs (Optional[DnsIpAddrs], default: None ) –

    The IP addresses of the remote DNS server associated with RemoteDomainName.

  • conditional_forwarder_ipv6_addrs (Optional[DnsIpv6Addrs], default: None ) –

    The IPv6 addresses of the remote DNS server associated with RemoteDomainName.

  • selective_auth (Optional[SelectiveAuth], default: None ) –

    Optional parameter to enable selective authentication for the trust.

Raises:

Examples:

To create a trust The following example creates a trust between Microsoft AD in the AWS cloud and an external domain.

>>> client.create_trust(directory_id='d-92654abfed', remote_domain_name='europe.example.com', trust_password='Str0ngP@ssw0rd', trust_direction='One-Way: Outgoing', trust_type='Forest', conditional_forwarder_ip_addrs=['172.30.21.228'])
Source code in docs_src/capo_directory_service/_services/directory_service.py
def create_trust(
    self,
    directory_id: "capo_directory_service.types.directory_id.DirectoryId",
    remote_domain_name: "capo_directory_service.types.remote_domain_name.RemoteDomainName",
    trust_password: "capo_directory_service.types.trust_password.TrustPassword",
    trust_direction: "capo_directory_service.types.trust_direction.TrustDirection",
    *,
    config_overrides: Optional[DirectoryServiceClientConfig] = None,
    trust_type: Optional[
        "capo_directory_service.types.trust_type.TrustType"
    ] = None,
    conditional_forwarder_ip_addrs: Optional[
        "capo_directory_service.types.dns_ip_addrs.DnsIpAddrs"
    ] = None,
    conditional_forwarder_ipv6_addrs: Optional[
        "capo_directory_service.types.dns_ipv6_addrs.DnsIpv6Addrs"
    ] = None,
    selective_auth: Optional[
        "capo_directory_service.types.selective_auth.SelectiveAuth"
    ] = None,
) -> "capo_directory_service.types.create_trust_result.CreateTrustResult":
    """<p>Directory Service for Microsoft Active Directory allows you to configure trust relationships. For example, you can establish a trust between your Managed Microsoft AD directory, and your existing self-managed Microsoft Active Directory. This would allow you to provide users and groups access to resources in either domain, with a single set of credentials.</p> <p>This action initiates the creation of the Amazon Web Services side of a trust relationship between an Managed Microsoft AD directory and an external domain. You can create either a forest trust or an external trust.</p>

    Args:
        directory_id: <p>The Directory ID of the Managed Microsoft AD directory for which to establish the trust relationship.</p>
        remote_domain_name: <p>The Fully Qualified Domain Name (FQDN) of the external domain for which to create the trust relationship.</p>
        trust_password: <p>The trust password. The trust password must be the same password that was used when creating the trust relationship on the external domain.</p>
        trust_direction: <p>The direction of the trust relationship.</p>
        trust_type: <p>The trust relationship type. <code>Forest</code> is the default.</p>
        conditional_forwarder_ip_addrs: <p>The IP addresses of the remote DNS server associated with RemoteDomainName.</p>
        conditional_forwarder_ipv6_addrs: <p>The IPv6 addresses of the remote DNS server associated with RemoteDomainName.</p>
        selective_auth: <p>Optional parameter to enable selective authentication for the trust.</p>

    Raises:
        capo_directory_service.errors.client_exception.ClientException: <p>A client exception has occurred.</p>
        capo_directory_service.errors.entity_already_exists_exception.EntityAlreadyExistsException: <p>The specified entity already exists.</p>
        capo_directory_service.errors.entity_does_not_exist_exception.EntityDoesNotExistException: <p>The specified entity could not be found.</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 trust
        The following example creates a trust between Microsoft AD in the AWS cloud and an external domain.

        >>> client.create_trust(directory_id='d-92654abfed', remote_domain_name='europe.example.com', trust_password='Str0ngP@ssw0rd', trust_direction='One-Way: Outgoing', trust_type='Forest', conditional_forwarder_ip_addrs=['172.30.21.228'])
    """

    def _handler(
        req: "OperationRequest[capo_directory_service.types.create_trust_request.CreateTrustRequest]",
    ) -> OperationResponse[
        "capo_directory_service.types.create_trust_result.CreateTrustResult"
    ]:
        import capo_directory_service._operations.directory_service_20150416.create_trust

        output, http_response = (
            capo_directory_service._operations.directory_service_20150416.create_trust.create_trust(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

        return capo_directory_service.types.create_trust_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateTrust", redact_input=_redact_input),
    )
    input_: capo_directory_service.types.create_trust_request.CreateTrustRequest = {
        "directory_id": directory_id,
        "remote_domain_name": remote_domain_name,
        "trust_password": trust_password,
        "trust_direction": trust_direction,
    }
    if trust_type is not None:
        input_["trust_type"] = trust_type
    if conditional_forwarder_ip_addrs is not None:
        input_["conditional_forwarder_ip_addrs"] = conditional_forwarder_ip_addrs
    if conditional_forwarder_ipv6_addrs is not None:
        input_["conditional_forwarder_ipv6_addrs"] = (
            conditional_forwarder_ipv6_addrs
        )
    if selective_auth is not None:
        input_["selective_auth"] = selective_auth

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output