forked from dsccommunity/SqlServerDsc
-
Notifications
You must be signed in to change notification settings - Fork 2
SqlAlias
johlju edited this page Jun 9, 2020
·
1 revision
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
Name | Key | String | The name of Alias (e.g. svr01\inst01). | |
Protocol | Write | String | Protocol to use when connecting. Valid values are 'TCP' or 'NP' (Named Pipes). Default value is 'TCP'. | TCP, NP |
ServerName | Write | String | The SQL Server you are aliasing (the NetBIOS name or FQDN). | |
TcpPort | Write | UInt16 | The TCP port SQL is listening on. Only used when protocol is set to 'TCP'. Default value is port 1433. | |
UseDynamicTcpPort | Write | Boolean | The UseDynamicTcpPort specify that the Net-Library will determine the port dynamically. The port specified in Port number will not be used. Default value is '$false'. | |
Ensure | Write | String | Determines whether the alias should be added or removed. Default value is 'Present' | Present, Absent |
PipeName | Read | String | Named Pipes path from the Get-TargetResource method. |
The SqlAlias
DSC resource is used to configure SQL Server Aliases on the node.
- Target machine must be running Windows Server 2012 or later.
All issues are not listed here, see here for all open issues.
This example shows how to ensure that the SQL Alias SQLDSC* exists with Named Pipes or TCP.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlAlias 'Add_SqlAlias_TCP'
{
Ensure = 'Present'
Name = 'SQLDSC-TCP'
ServerName = 'sqltest.company.local\DSC'
Protocol = 'TCP'
TcpPort = 1777
PsDscRunAsCredential = $SqlAdministratorCredential
}
SqlAlias 'Add_SqlAlias_TCPUseDynamicTcpPort'
{
Ensure = 'Present'
Name = 'SQLDSC-DYN'
ServerName = 'sqltest.company.local\DSC'
Protocol = 'TCP'
UseDynamicTcpPort = $true
PsDscRunAsCredential = $SqlAdministratorCredential
}
SqlAlias 'Add_SqlAlias_NP'
{
Ensure = 'Present'
Name = 'SQLDSC-NP'
ServerName = '\\sqlnode\PIPE\sql\query'
Protocol = 'NP'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}
This example shows how to ensure that the SQL Alias SQLDSC* does not exist with Named Pipes or TCP.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlAlias 'Remove_SqlAlias_TCP'
{
Ensure = 'Absent'
Name = 'SQLDSC-TCP'
ServerName = 'sqltest.company.local\DSC'
Protocol = 'TCP'
TcpPort = 1777
PsDscRunAsCredential = $SqlAdministratorCredential
}
SqlAlias 'Remove_SqlAlias_NP'
{
Ensure = 'Absent'
Name = 'SQLDSC-NP'
ServerName = '\\sqlnode\PIPE\sql\query'
Protocol = 'NP'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}
- SqlAG
- SqlAGDatabase
- SqlAgentAlert
- SqlAgentFailsafe
- SqlAgentOperator
- SqlAGListener
- SqlAGReplica
- SqlAlias
- SqlAlwaysOnService
- SqlConfiguration
- SqlDatabase
- SqlDatabaseDefaultLocation
- SqlDatabaseMail
- SqlDatabaseObjectPermission
- SqlDatabaseOwner
- SqlDatabasePermission
- SqlDatabaseRecoveryModel
- SqlDatabaseRole
- SqlDatabaseUser
- SqlEndpoint
- SqlEndpointPermission
- SqlLogin
- SqlMaxDop
- SqlMemory
- SqlPermission
- SqlProtocol
- SqlProtocolTcpIp
- SqlReplication
- SqlRole
- SqlRS
- SqlRSSetup
- SqlScript
- SqlScriptQuery
- SqlSecureConnection
- SqlServerConfiguration
- SqlServerDatabaseMail
- SqlServerEndpoint
- SqlServerEndpointPermission
- SqlServerEndpointState
- SqlServerLogin
- SqlServerMaxDop
- SqlServerMemory
- SqlServerNetwork
- SqlServerPermission
- SqlServerProtocol
- SqlServerProtocolTcpIp
- SqlServerReplication
- SqlServerRole
- SqlServerSecureConnection
- SqlServiceAccount
- SqlSetup
- SqlWaitForAG
- SqlWindowsFirewall