-
Notifications
You must be signed in to change notification settings - Fork 225
SqlAlias
dscbot edited this page Oct 26, 2024
·
9 revisions
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' (TCP/IP) or 'NP' (Named Pipes). Default value is 'TCP' . |
TCP , NP
|
ServerName | Write | String | The SQL Server you are aliasing. This should be set to the NetBIOS name or fully qualified domain name (FQDN). | |
TcpPort | Write | UInt16 | The TCP port the SQL Server instance is listening on. Only used when Protocol is set to 'TCP' . Default value is port 1433 . |
|
UseDynamicTcpPort | Write | Boolean | Specifies that the Net-Library will determine the port dynamically. The port number specified in Port will be ignored. Default value is $false . |
|
Ensure | Write | String | Determines whether the alias should be added ('Present' ) or removed ('Absent' ). Default value is 'Present' . |
Present , Absent
|
PipeName | Read | String | Returns the Named Pipes path if Protocol is set to 'NP' . |
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
}
}
}
- Add-SqlDscNode
- Add-SqlDscTraceFlag
- Complete-SqlDscFailoverCluster
- Complete-SqlDscImage
- Connect-SqlDscDatabaseEngine
- ConvertFrom-SqlDscDatabasePermission
- ConvertFrom-SqlDscServerPermission
- ConvertTo-SqlDscDatabasePermission
- ConvertTo-SqlDscServerPermission
- Disable-SqlDscAudit
- Disconnect-SqlDscDatabaseEngine
- Enable-SqlDscAudit
- Get-SqlDscAudit
- Get-SqlDscConfigurationOption
- Get-SqlDscDatabasePermission
- Get-SqlDscManagedComputer
- Get-SqlDscManagedComputerService
- Get-SqlDscPreferredModule
- Get-SqlDscServerPermission
- Get-SqlDscStartupParameter
- Get-SqlDscTraceFlag
- Import-SqlDscPreferredModule
- Initialize-SqlDscRebuildDatabase
- Install-SqlDscServer
- Invoke-SqlDscQuery
- New-SqlDscAudit
- Remove-SqlDscAudit
- Remove-SqlDscNode
- Remove-SqlDscTraceFlag
- Repair-SqlDscServer
- Save-SqlDscSqlServerMediaFile
- Set-SqlDscAudit
- Set-SqlDscDatabasePermission
- Set-SqlDscServerPermission
- Set-SqlDscStartupParameter
- Set-SqlDscTraceFlag
- Test-SqlDscIsDatabasePrincipal
- Test-SqlDscIsLogin
- Test-SqlDscIsSupportedFeature
- Uninstall-SqlDscServer
- SqlAG
- SqlAGDatabase
- SqlAgentAlert
- SqlAgentFailsafe
- SqlAgentOperator
- SqlAGListener
- SqlAGReplica
- SqlAlias
- SqlAlwaysOnService
- SqlAudit
- SqlConfiguration
- SqlDatabase
- SqlDatabaseDefaultLocation
- SqlDatabaseMail
- SqlDatabaseObjectPermission
- SqlDatabasePermission
- SqlDatabaseRole
- SqlDatabaseUser
- SqlEndpoint
- SqlEndpointPermission
- SqlLogin
- SqlMaxDop
- SqlMemory
- SqlPermission
- SqlProtocol
- SqlProtocolTcpIp
- SqlReplication
- SqlRole
- SqlRS
- SqlRSSetup
- SqlScript
- SqlScriptQuery
- SqlSecureConnection
- SqlServiceAccount
- SqlSetup
- SqlTraceFlag
- SqlWaitForAG
- SqlWindowsFirewall