forked from dsccommunity/SqlServerDsc
-
Notifications
You must be signed in to change notification settings - Fork 2
SqlServiceAccount
johlju edited this page Jun 19, 2020
·
2 revisions
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
InstanceName | Key | String | Name of the SQL instance. | |
ServiceType | Key | String | Type of service being managed. | DatabaseEngine, SQLServerAgent, Search, IntegrationServices, AnalysisServices, ReportingServices, SQLServerBrowser, NotificationServices |
ServiceAccount | Required | PSCredential | The service account that should be used when running the service. | |
ServerName | Write | String | Host name of the SQL Server to manage. Default value is $env:COMPUTERNAME. | |
RestartService | Write | Boolean | Determines whether the service is automatically restarted when a change to the configuration was needed. | |
Force | Write | Boolean | Forces the service account to be updated. Useful for password changes. | |
ServiceAccountName | Read | String | Returns the service account username for the service. | |
VersionNumber | Write | String | The version number for the service, mandatory with IntegrationServices ServiceType |
The SqlServiceAccount
DSC resource manages the service account for SQL
Server services.
- Target machine must have access to the SQLPS PowerShell module or the SqlServer PowerShell module.
All issues are not listed here, see here for all open issues.
This example shows how to ensure the SQL Server service on TestServer is running under a user account.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$ServiceAccountCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
Node localhost
{
SqlServiceAccount 'SetServiceAccount_User'
{
ServerName = 'TestServer'
InstanceName = 'MSSQLSERVER'
ServiceType = 'DatabaseEngine'
ServiceAccount = $ServiceAccountCredential
RestartService = $true
}
}
}
This example shows how to ensure the SQL Server service on TestServer\DSC is running under a virtual account. Force will cause this account to be set every time the configuration is evaluated. Specifying RestartService will cause the service to be restarted.
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$ServiceAccountCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
Node localhost
{
SqlServiceAccount 'SetServiceAccount_User'
{
ServerName = 'TestServer'
InstanceName = 'DSC'
ServiceType = 'DatabaseEngine'
ServiceAccount = $ServiceAccountCredential
RestartService = $true
Force = $true
}
}
}
- 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