New-SqlHadrEndpoint

Creates a database mirroring endpoint on an instance of SQL Server.
New-SqlHadrEndpoint [-Name*] <string> [[-Path] <string>] [-AuthenticationOrder <EndpointAuthenticationOrder>][-Certificate <string>] [-Encryption <EndpointEncryption>] [-EncryptionAlgorithm <EndpointEncryptionAlgorithm>][-IpAddress <string>] [-Owner <string>] [-Port <int>] [-Script] [-Confirm] [-WhatIf] [<CommonParameters>]
New-SqlHadrEndpoint [-Name*] <string> [-InputObject*] <Server> [-AuthenticationOrder <EndpointAuthenticationOrder>][-Certificate <string>] [-Encryption <EndpointEncryption>] [-EncryptionAlgorithm <EndpointEncryptionAlgorithm>][-IpAddress <string>] [-Owner <string>] [-Port <int>] [-Script] [-Confirm] [-WhatIf] [<CommonParameters>]

The New-SqlHadrndpoint cmdlet creates a database mirroring endpoint on the specified instance of SQL Server. This endpoint is required on every server instance that hosts an availability replica for any availability group. Each server instance can only have one database mirroring endpoint. If a server instance already possesses a database mirroring endpoint, use the existing endpoint.

Parameters
-AuthenticationOrder <EndpointAuthenticationOrder>

  • Default value is SMO.EndpointAuthenticationOrder.Negotiate

The order and type of authentication that is used by the endpoint. The options are Certificate, CertificateKerberos , CertificateNegotiate, CertificateNtlm, Kerberos, KerberosCertificate, Negotiate, NegotiateCertificate, Ntlm, and NtlmCertificate. If the specified option calls for a certificate, the -Certificate parameter must also be set.

-Certificate <string>

The name of the certificate the endpoint should use to authenticate connections. The far endpoint must have a certificate with the public key matching the private key of the specified certificate.

-Encryption <EndpointEncryption>

  • Default value is SMO.EndpointAuthentication.Required

The encryption option for the endpoint. The options are Disabled, Supported, or Required. Required is the default value.

-EncryptionAlgorithm <EndpointEncryptionAlgorithm>

  • Default value is RC4

The form of encryption used by the endpoint. The options are Aes, AesRC4, None, RC4, and RC4Aes. By default the endpoint will use Aes encryption. NOTE: The RC4 algorithm is only supported for backward compatibility. New material can only be encrypted using RC4 or RC4_128 when the database is in compatibility level 90 or 100. (Not recommended.) Use a newer algorithm such as one of the AES algorithms instead.

-InputObject <Server>

  • This value is required
  • Accepts pipeline input ByValue

The Server object of the instance of SQL Server where the endpoint should be created.

-IpAddress <string>

The IP address that the endpoint will listen on. The default is ALL, which indicates that the listener will accept a connection on any valid IP address.

-Name <string>

  • This value is required

The name of the endpoint to be created. This is a mandatory parameter.

-Owner <string>

The login of the owner of the endpoint. By default, this is the current login.

-Path <string>

The path to the instance of SQL Server where the endpoint is to be created. This is an optional parameter. If not specified, the value of this parameter defaults to the current working location.

-Port <int>

  • Default value is 5022

The TCP port on which the endpoint will listen on for connections. The default port is 5022.

-Script [<SwitchParameter>]

Outputs a Transact-SQL script that performs the task executed by this cmdlet.

-Confirm [<SwitchParameter>]

Prompts you for confirmation before executing the command.

-WhatIf [<SwitchParameter>]

Describes what would happen if you executed the command without actually executing the command.

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Inputs

SMO.Server

This parameter specifies the server instance on which the endpoint is to be created.

Outputs

SMO.Endpoint

Examples
  1. This command creates a database mirroring endpoint named ‘MyEndpoint’ on the server instance located at the specified path:
    C:PS> New-SqlHADREndpoint -Path SQLSERVER:SqlComputerInstance -Name MyEndpoint
    

    This endpoint uses the default port, 5022.

  2. This command creates a database mirroring endpoint named ‘MyEndpoint’ on the server instance located at the specified path:
    C:PS> New-SqlHADREndpoint -Path SQLSERVER:SqlComputerInstance -Name EndpointName -Port 4022 -EncryptionAlgorithm 'Aes' -Encryption 'Required'
    

    This endpoint listens on point 4022. The endpoint uses the AES algorithm for encryption and requires that connections use encryption.

  3. This command creates a database mirroring endpoint named ‘MyEndpoint’ on the server instance located at the specified path:
    C:PS> New-SqlHADREndpoint -Path SQLSERVER:SqlComputerInstance -Name EndpointName -AuthenticationOrder 'Certificate' -Certificate 'MyCertificate'
    

    This endpoint uses the certificate named ‘MyCertificate’ to authenticate connections.

  4. This command outputs the Transact-SQL script that creates a database mirroring endpoint named ‘MyEndpoint’ on the server instance located at the specified path:
    C:PS> New-SqlHADREndpoint -Path SQLSERVER:SqlComputerInstance -Name MyEndpoint -Script
    

    The endpoint is not actually created by this command.

Additional Notes
 
Related Links