SqlEndpoint - johlju/SqlServerDsc GitHub Wiki
SqlEndpoint
Parameters
| Parameter | Attribute | DataType | Description | Allowed Values |
|---|---|---|---|---|
| EndpointName | Key | String | The name of the endpoint. | |
| InstanceName | Key | String | The name of the SQL instance to be configured. | |
| EndpointType | Required | String | Specifies the type of endpoint. Currently the only type that is supported is the Database Mirror type. | DatabaseMirroring |
| Ensure | Write | String | If the endpoint should be present or absent. Default values is 'Present'. | Present, Absent |
| Port | Write | UInt16 | The network port the endpoint is listening on. Default value is 5022, but default value is only used during endpoint creation, it is not enforce. | |
| ServerName | Write | String | The host name of the SQL Server to be configured. Default value is $env:COMPUTERNAME. | |
| IpAddress | Write | String | The network IP address the endpoint is listening on. Default the endpoint will listen on any valid IP address. The default value is only used during endpoint creation, it is not enforce. | |
| Owner | Write | String | The owner of the endpoint. Default is the login used for the creation. | |
| State | Write | String | Specifies the state of the endpoint. Valid states are Started, Stopped, or Disabled. When an endpoint is created and the state is not specified then the endpoint will be started after it is created. The state will not be enforced unless the parameter is specified. | Started, Stopped, Disabled |
Description
The SqlEndpoint DSC resource is used to create an endpoint. Currently
it only supports creating a database mirror endpoint. A database mirror
endpoint can be used by AlwaysOn.
Note: The endpoint will be started after creation, but will not be enforced unless the the parameter
Stateis specified. To set connect permission to the endpoint, please use the resource SqlEndpointPermission.
Requirements
- Target machine must be running Windows Server 2012 or later.
- Target machine must be running SQL Server Database Engine 2012 or later.
Security Requirements
- The built-in parameter PsDscRunAsCredential must be set to the credentials of an account with the permission to create and alter endpoints.
Known issues
All issues are not listed here, see here for all open issues.
Examples
Example 1
This example will add a Database Mirror endpoint, to two instances, using the default values.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlEndpoint 'SQLConfigureEndpoint-Instance1'
{
EndpointName = 'HADR'
EndpointType = 'DatabaseMirroring'
InstanceName = 'INST1'
PsDscRunAsCredential = $SqlAdministratorCredential
}
SqlEndpoint 'SQLConfigureEndpoint-Instances2'
{
EndpointName = 'HADR'
EndpointType = 'DatabaseMirroring'
InstanceName = 'INST2'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}
Example 2
This example will add a Database Mirror endpoint with specific listener port, listener IP address and owner.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlEndpoint 'SQLConfigureEndpoint'
{
Ensure = 'Present'
EndpointName = 'HADR'
EndpointType = 'DatabaseMirroring'
Port = 9001
IpAddress = '192.168.0.20'
Owner = 'sa'
State = 'Started'
ServerName = 'server1.company.local'
InstanceName = 'INST1'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}
Example 3
This example will remove an Database Mirror endpoint from two instances.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlEndpoint 'SQLConfigureEndpoint-Instance1'
{
Ensure = 'Absent'
EndpointName = 'HADR'
EndpointType = 'DatabaseMirroring'
InstanceName = 'INST1'
PsDscRunAsCredential = $SqlAdministratorCredential
}
SqlEndpoint 'SQLConfigureEndpoint-Instance2'
{
Ensure = 'Absent'
EndpointName = 'HADR'
EndpointType = 'DatabaseMirroring'
InstanceName = 'INST2'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}