From a450e82d79b049786d26dc16008f91bfc6f59a4f Mon Sep 17 00:00:00 2001 From: Nick Reilingh Date: Wed, 22 Aug 2018 04:58:17 -0400 Subject: [PATCH 1/7] SqlAGDatabase: Corrected PsDscRunAsAccount to PsDscRunAsCredential (#1199) - Changes to SqlAGDatabase - Corrected reference to "PsDscRunAsAccount" in documentation (issue #1199). --- CHANGELOG.md | 5 +++++ .../MSFT_SqlAGDatabase/MSFT_SqlAGDatabase.schema.mof | 2 +- README.md | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83131e47a..d46b8a0ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Unreleased +- Changes to SqlAGDatabase + - Corrected reference to "PsDscRunAsAccount" in documentation + ([issue #1199](https://github.com/PowerShell/SqlServerDsc/issues/1199)). + [Nick Reilingh (@NReilingh)](https://github.com/NReilingh) + ## 11.4.0.0 - Changes to SqlServerDsc diff --git a/DSCResources/MSFT_SqlAGDatabase/MSFT_SqlAGDatabase.schema.mof b/DSCResources/MSFT_SqlAGDatabase/MSFT_SqlAGDatabase.schema.mof index 1a9628f19..a4c183253 100644 --- a/DSCResources/MSFT_SqlAGDatabase/MSFT_SqlAGDatabase.schema.mof +++ b/DSCResources/MSFT_SqlAGDatabase/MSFT_SqlAGDatabase.schema.mof @@ -8,7 +8,7 @@ class MSFT_SqlAGDatabase : OMI_BaseResource [Required, Description("The path used to seed the availability group replicas. This should be a path that is accessible by all of the replicas")] String BackupPath; [Write, Description("Specifies the membership of the database(s) in the availability group. The options are: Present: The defined database(s) are added to the availability group. All other databases that may be a member of the availability group are ignored. Absent: The defined database(s) are removed from the availability group. All other databases that may be a member of the availability group are ignored. The default is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; [Write, Description("When used with 'Ensure = 'Present'' it ensures the specified database(s) are the only databases that are a member of the specified Availability Group. This parameter is ignored when 'Ensure' is 'Absent'.")] Boolean Force; - [Write, Description("If set to $true, this ensures the database owner of the database on the primary replica is the owner of the database on all secondary replicas. This requires the database owner is available as a login on all replicas and that the PSDscRunAsAccount has impersonate permissions. If set to $false, the owner of the database will be the PSDscRunAsAccount. The default is '$true'")] Boolean MatchDatabaseOwner; + [Write, Description("If set to $true, this ensures the database owner of the database on the primary replica is the owner of the database on all secondary replicas. This requires the database owner is available as a login on all replicas and that the PsDscRunAsCredential has impersonate permissions. If set to $false, the owner of the database will be the PsDscRunAsCredential. The default is '$true'")] Boolean MatchDatabaseOwner; [Write, Description("Specifies that the resource will only determine if a change is needed if the target node is the active host of the SQL Server Instance.")] Boolean ProcessOnlyOnActiveNode; [Read, Description("Determines if the current node is actively hosting the SQL Server instance.")] Boolean IsActiveNode; }; diff --git a/README.md b/README.md index b8a6d3374..6e01b9a0f 100644 --- a/README.md +++ b/README.md @@ -286,8 +286,8 @@ group. * **`[Boolean]` MatchDatabaseOwner** _(Write)_: If set to $true, this ensures the database owner of the database on the primary replica is the owner of the database on all secondary replicas. This requires the database owner is available as a - login on all replicas and that the PSDscRunAsAccount has impersonate permissions. - If set to $false, the owner of the database will be the PSDscRunAsAccount. + login on all replicas and that the PsDscRunAsCredential has impersonate permissions. + If set to $false, the owner of the database will be the PsDscRunAsCredential. The default is '$true'. * **`[Boolean]` ProcessOnlyOnActiveNode** _(Write)_: Specifies that the resource will only determine if a change is needed if the target node is the active From f72dd2c40ffb43782a5969b3a51803ccf2c027f1 Mon Sep 17 00:00:00 2001 From: Apichaya Sakchaichanchol Date: Mon, 27 Aug 2018 00:50:27 -0700 Subject: [PATCH 2/7] BREAKING CHANGE: SqlDatabaseOwner: Support multi-instances (#1204) - Changes to SqlDatabaseOwner - BREAKING CHANGE: Support multiple instances on the same node. The parameter InstanceName is now Key and cannot be omitted (issue #1197). --- CHANGELOG.md | 4 ++++ .../MSFT_SqlDatabaseOwner.psm1 | 12 +++++----- .../MSFT_SqlDatabaseOwner.schema.mof | 2 +- .../SqlDatabaseOwner/1-SetDatabaseOwner.ps1 | 23 +++++++++++++++++-- README.md | 2 +- Tests/Unit/MSFT_SqlDatabaseOwner.Tests.ps1 | 6 ++--- 6 files changed, 36 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d46b8a0ad..e33da5045 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - Corrected reference to "PsDscRunAsAccount" in documentation ([issue #1199](https://github.com/PowerShell/SqlServerDsc/issues/1199)). [Nick Reilingh (@NReilingh)](https://github.com/NReilingh) +- Changes to SqlDatabaseOwner + - BREAKING CHANGE: Support multiple instances on the same node. + The parameter InstanceName is now Key and cannot be omitted. + ([issue #1197](https://github.com/PowerShell/SqlServerDsc/issues/1197)). ## 11.4.0.0 diff --git a/DSCResources/MSFT_SqlDatabaseOwner/MSFT_SqlDatabaseOwner.psm1 b/DSCResources/MSFT_SqlDatabaseOwner/MSFT_SqlDatabaseOwner.psm1 index fd0c03a1d..428f7e5d5 100644 --- a/DSCResources/MSFT_SqlDatabaseOwner/MSFT_SqlDatabaseOwner.psm1 +++ b/DSCResources/MSFT_SqlDatabaseOwner/MSFT_SqlDatabaseOwner.psm1 @@ -38,10 +38,10 @@ function Get-TargetResource [System.String] $ServerName = $env:COMPUTERNAME, - [Parameter()] + [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [System.String] - $InstanceName = 'MSSQLSERVER' + $InstanceName ) Write-Verbose -Message "Getting owner of database $Database" @@ -116,10 +116,10 @@ function Set-TargetResource [System.String] $ServerName = $env:COMPUTERNAME, - [Parameter()] + [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [System.String] - $InstanceName = 'MSSQLSERVER' + $InstanceName ) Write-Verbose -Message "Setting owner $Name of database $Database" @@ -191,10 +191,10 @@ function Test-TargetResource [System.String] $ServerName = $env:COMPUTERNAME, - [Parameter()] + [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [System.String] - $InstanceName = 'MSSQLSERVER' + $InstanceName ) Write-Verbose -Message "Testing owner $Name of database $Database" diff --git a/DSCResources/MSFT_SqlDatabaseOwner/MSFT_SqlDatabaseOwner.schema.mof b/DSCResources/MSFT_SqlDatabaseOwner/MSFT_SqlDatabaseOwner.schema.mof index c488b2e42..7f7aaa8c9 100644 --- a/DSCResources/MSFT_SqlDatabaseOwner/MSFT_SqlDatabaseOwner.schema.mof +++ b/DSCResources/MSFT_SqlDatabaseOwner/MSFT_SqlDatabaseOwner.schema.mof @@ -4,5 +4,5 @@ class MSFT_SqlDatabaseOwner : OMI_BaseResource [Key, Description("The name of database to be configured.")] String Database; [Required, Description("The name of the login that will become a owner of the desired sql database.")] String Name; [Write, Description("The host name of the SQL Server to be configured.")] String ServerName; - [Write, Description("The name of the SQL instance to be configured.")] String InstanceName; + [Key, Description("The name of the SQL instance to be configured.")] String InstanceName; }; diff --git a/Examples/Resources/SqlDatabaseOwner/1-SetDatabaseOwner.ps1 b/Examples/Resources/SqlDatabaseOwner/1-SetDatabaseOwner.ps1 index ff3450ac3..ed823b5ba 100644 --- a/Examples/Resources/SqlDatabaseOwner/1-SetDatabaseOwner.ps1 +++ b/Examples/Resources/SqlDatabaseOwner/1-SetDatabaseOwner.ps1 @@ -16,7 +16,7 @@ Configuration Example node localhost { - SqlServerLogin Add_SqlServerLogin_SQLAdmin + SqlServerLogin Add_SqlServerLogin_SQLAdmin_DSC { Ensure = 'Present' Name = 'CONTOSO\SQLAdmin' @@ -26,7 +26,17 @@ Configuration Example PsDscRunAsCredential = $SqlAdministratorCredential } - SqlDatabaseOwner Set_SqlDatabaseOwner_SQLAdmin + SqlServerLogin Add_SqlServerLogin_SQLAdmin_DSC2 + { + Ensure = 'Present' + Name = 'CONTOSO\SQLAdmin' + LoginType = 'WindowsUser' + ServerName = 'sqltest.company.local' + InstanceName = 'DSC2' + PsDscRunAsCredential = $SqlAdministratorCredential + } + + SqlDatabaseOwner Set_SqlDatabaseOwner_SQLAdmin_DSC { Name = 'CONTOSO\SQLAdmin' Database = 'AdventureWorks' @@ -34,5 +44,14 @@ Configuration Example InstanceName = 'DSC' PsDscRunAsCredential = $SqlAdministratorCredential } + + SqlDatabaseOwner Set_SqlDatabaseOwner_SQLAdmin_DSC2 + { + Name = 'CONTOSO\SQLAdmin' + Database = 'AdventureWorks' + ServerName = 'sqltest.company.local' + InstanceName = 'DSC2' + PsDscRunAsCredential = $SqlAdministratorCredential + } } } diff --git a/README.md b/README.md index 6e01b9a0f..23b77c936 100644 --- a/README.md +++ b/README.md @@ -587,7 +587,7 @@ For more information about database owner, please read the article * **`[String]` Name** _(Required)_: The name of the login that will become a owner of the desired sql database. * **`[String]` ServerName** _(Write)_: The host name of the SQL Server to be configured. -* **`[String]` InstanceName** _(Write)_: The name of the SQL instance to be configured. +* **`[String]` InstanceName** _(Key)_: The name of the SQL instance to be configured. #### Examples diff --git a/Tests/Unit/MSFT_SqlDatabaseOwner.Tests.ps1 b/Tests/Unit/MSFT_SqlDatabaseOwner.Tests.ps1 index d7fd9ca14..9364456b1 100644 --- a/Tests/Unit/MSFT_SqlDatabaseOwner.Tests.ps1 +++ b/Tests/Unit/MSFT_SqlDatabaseOwner.Tests.ps1 @@ -117,7 +117,7 @@ try Context 'When the system is either in the desired state or not in the desired state' { It 'Should not throw' { - $testParameters = $defaultParameters + $testParameters = $mockDefaultParameters $testParameters += @{ Database = $mockSqlDatabaseName Name = $mockSqlServerLogin @@ -151,7 +151,7 @@ try Context 'When the system is not in the desired state' { It 'Should return the state as false when desired login is not the database owner' { - $testParameters = $defaultParameters + $testParameters = $mockDefaultParameters $testParameters += @{ Database = $mockSqlDatabaseName Name = $mockSqlServerLogin @@ -170,7 +170,7 @@ try It 'Should return the state as true when desired login is the database owner' { $mockDatabaseOwner = 'Zebes\SamusAran' $mockSqlServerLogin = 'Zebes\SamusAran' - $testParameters = $defaultParameters + $testParameters = $mockDefaultParameters $testParameters += @{ Database = $mockSqlDatabaseName Name = $mockSqlServerLogin From 3714325ef731719da3e7e949ebaa278588e05ab9 Mon Sep 17 00:00:00 2001 From: Maxime Daniou Date: Thu, 30 Aug 2018 15:22:28 +0200 Subject: [PATCH 3/7] SqlSetup: Add missing service StartupType (DBE,AGT,AS,IS,RS) (#1184) - Changes to SqlSetup - Added new parameters to allow to define the startup types for the Sql Engine service, the Agent service, the Analysis service and the Integration Service. The new optional parameters are respectively SqlSvcStartupType, AgtSvcStartupType, AsSvcStartupType, IsSvcStartupType and RsSvcStartupType (issue #1165). --- CHANGELOG.md | 5 + DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1 | 199 +++++++++++++++--- .../MSFT_SqlSetup/MSFT_SqlSetup.schema.mof | 5 + ...gleServerWithAgtSvcStartupTypeDisabled.ps1 | 94 +++++++++ README.md | 13 +- .../MSFT_SqlSetup.Integration.Tests.ps1 | 3 + Tests/Integration/MSFT_SqlSetup.config.ps1 | 3 + Tests/Unit/MSFT_SqlSetup.Tests.ps1 | 105 ++++++--- 8 files changed, 368 insertions(+), 59 deletions(-) create mode 100644 Examples/Resources/SqlSetup/6-InstallNamedInstanceSingleServerWithAgtSvcStartupTypeDisabled.ps1 diff --git a/CHANGELOG.md b/CHANGELOG.md index e33da5045..ce824f0c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,11 @@ forced to be reimported into the session. This is to support that a never version of SQL Server was installed side-by-side so that SQLPS module should be used instead. + - Added new parameters to allow to define the startup types for the Sql Engine + service, the Agent service, the Analysis service and the Integration Service. + The new optional parameters are respectively SqlSvcStartupType, AgtSvcStartupType, + AsSvcStartupType, IsSvcStartupType and RsSvcStartupType. ([issue #1165](https://github.com/PowerShell/SqlServerDsc/issues/1165). + [Maxime Daniou (@mdaniou)](https://github.com/mdaniou) ## 11.3.0.0 diff --git a/DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1 b/DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1 index 9cdbec2a3..c44cc376e 100644 --- a/DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1 +++ b/DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1 @@ -12,7 +12,7 @@ $script:localizedData = Get-LocalizedData -ResourceName 'MSFT_SqlSetup' .PARAMETER Action The action to be performed. Default value is 'Install'. - Possible values are 'Install', 'InstallFailoverCluster', 'AddNode', 'PrepareFailoverCluster', and 'CompleteFailoverCluster' + Possible values are 'Install', 'InstallFailoverCluster', 'AddNode', 'PrepareFailoverCluster', and 'CompleteFailoverCluster'. .PARAMETER SourcePath The path to the root of the source files for installation. I.e and UNC path to a shared resource. Environment variables can be used in the path. @@ -30,7 +30,7 @@ $script:localizedData = Get-LocalizedData -ResourceName 'MSFT_SqlSetup' Name of the SQL instance to be installed. .PARAMETER FailoverClusterNetworkName - Host name to be assigned to the clustered SQL Server instance + Host name to be assigned to the clustered SQL Server instance. #> function Get-TargetResource { @@ -125,9 +125,15 @@ function Get-TargetResource Write-Verbose -Message $script:localizedData.DatabaseEngineFeatureFound $features += 'SQLENGINE,' + + $sqlServiceCimInstance = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$databaseServiceName'") + $agentServiceCimInstance = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$agentServiceName'") - $sqlServiceAccountUsername = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$databaseServiceName'").StartName - $agentServiceAccountUsername = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$agentServiceName'").StartName + $sqlServiceAccountUsername = $sqlServiceCimInstance.StartName + $agentServiceAccountUsername = $agentServiceCimInstance.StartName + + $SqlSvcStartupType = ConvertTo-StartupType -StartMode $sqlServiceCimInstance.StartMode + $AgtSvcStartupType = ConvertTo-StartupType -StartMode $agentServiceCimInstance.StartMode $fullInstanceId = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL' -Name $InstanceName).$InstanceName @@ -269,7 +275,9 @@ function Get-TargetResource Write-Verbose -Message $script:localizedData.ReportingServicesFeatureFound $features += 'RS,' - $reportingServiceAccountUsername = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$reportServiceName'").StartName + $reportingServiceCimInstance = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$reportServiceName'") + $reportingServiceAccountUsername = $reportingServiceCimInstance.StartName + $RsSvcStartupType = ConvertTo-StartupType -StartMode $reportingServiceCimInstance.StartMode } else { @@ -283,7 +291,9 @@ function Get-TargetResource Write-Verbose -Message $script:localizedData.AnalysisServicesFeatureFound $features += 'AS,' - $analysisServiceAccountUsername = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$analysisServiceName'").StartName + $analysisServiceCimInstance = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$analysisServiceName'") + $analysisServiceAccountUsername = $analysisServiceCimInstance.StartName + $AsSvcStartupType = ConvertTo-StartupType -StartMode $analysisServiceCimInstance.StartMode $analysisServer = Connect-SQLAnalysis -SQLServer $sqlHostName -SQLInstanceName $InstanceName @@ -320,7 +330,9 @@ function Get-TargetResource Write-Verbose -Message $script:localizedData.IntegrationServicesFeatureFound $features += 'IS,' - $integrationServiceAccountUsername = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$integrationServiceName'").StartName + $integrationServiceCimInstance = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$integrationServiceName'") + $integrationServiceAccountUsername = $integrationServiceCimInstance.StartName + $IsSvcStartupType = ConvertTo-StartupType -StartMode $integrationServiceCimInstance.StartMode } else { @@ -478,7 +490,9 @@ function Get-TargetResource InstallSharedWOWDir = $installSharedWOWDir InstanceDir = $instanceDirectory SQLSvcAccountUsername = $sqlServiceAccountUsername + SqlSvcStartupType = $SqlSvcStartupType AgtSvcAccountUsername = $agentServiceAccountUsername + AgtSvcStartupType = $AgtSvcStartupType SQLCollation = $sqlCollation SQLSysAdminAccounts = $sqlSystemAdminAccounts SecurityMode = $securityMode @@ -490,7 +504,9 @@ function Get-TargetResource SQLBackupDir = $sqlBackupDirectory FTSvcAccountUsername = $fullTextServiceAccountUsername RSSvcAccountUsername = $reportingServiceAccountUsername + RsSvcStartupType = $RsSvcStartupType ASSvcAccountUsername = $analysisServiceAccountUsername + AsSvcStartupType = $AsSvcStartupType ASCollation = $analysisCollation ASSysAdminAccounts = $analysisSystemAdminAccounts ASDataDir = $analysisDataDirectory @@ -500,6 +516,7 @@ function Get-TargetResource ASConfigDir = $analysisConfigDirectory ASServerMode = $analysisServerMode ISSvcAccountUsername = $integrationServiceAccountUsername + IsSvcStartupType = $IsSvcStartupType FailoverClusterGroupName = $clusteredSqlGroupName FailoverClusterNetworkName = $clusteredSqlHostname FailoverClusterIPAddress = $clusteredSqlIPAddress @@ -512,7 +529,7 @@ function Get-TargetResource .PARAMETER Action The action to be performed. Default value is 'Install'. - Possible values are 'Install', 'InstallFailoverCluster', 'AddNode', 'PrepareFailoverCluster', and 'CompleteFailoverCluster' + Possible values are 'Install', 'InstallFailoverCluster', 'AddNode', 'PrepareFailoverCluster', and 'CompleteFailoverCluster'. .PARAMETER SourcePath The path to the root of the source files for installation. I.e and UNC path to a shared resource. Environment variables can be used in the path. @@ -644,17 +661,32 @@ function Get-TargetResource .PARAMETER ISSvcAccount Service account for Integration Services service. + .PARAMETER SqlSvcStartupType + Specifies the startup mode for SQL Server Engine service. + + .PARAMETER AgtSvcStartupType + Specifies the startup mode for SQL Server Agent service. + + .PARAMETER AsSvcStartupType + Specifies the startup mode for SQL Server Analysis service. + + .PARAMETER IsSvcStartupType + Specifies the startup mode for SQL Server Integration service. + + .PARAMETER RsSvcStartupType + Specifies the startup mode for SQL Server Report service. + .PARAMETER BrowserSvcStartupType - Specifies the startup mode for SQL Server Browser service + Specifies the startup mode for SQL Server Browser service. .PARAMETER FailoverClusterGroupName The name of the resource group to create for the clustered SQL Server instance. Default is 'SQL Server (InstanceName)'. .PARAMETER FailoverClusterIPAddress - Array of IP Addresses to be assigned to the clustered SQL Server instance + Array of IP Addresses to be assigned to the clustered SQL Server instance. .PARAMETER FailoverClusterNetworkName - Host name to be assigned to the clustered SQL Server instance + Host name to be assigned to the clustered SQL Server instance. .PARAMETER SetupProcessTimeout The timeout, in seconds, to wait for the setup process to finish. Default value is 7200 seconds (2 hours). If the setup process does not finish before this time, and error will be thrown. @@ -837,6 +869,31 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $ISSvcAccount, + [Parameter()] + [System.String] + [ValidateSet('Automatic', 'Disabled', 'Manual')] + $SqlSvcStartupType, + + [Parameter()] + [System.String] + [ValidateSet('Automatic', 'Disabled', 'Manual')] + $AgtSvcStartupType, + + [Parameter()] + [System.String] + [ValidateSet('Automatic', 'Disabled', 'Manual')] + $IsSvcStartupType, + + [Parameter()] + [System.String] + [ValidateSet('Automatic', 'Disabled', 'Manual')] + $AsSvcStartupType, + + [Parameter()] + [System.String] + [ValidateSet('Automatic', 'Disabled', 'Manual')] + $RsSvcStartupType, + [Parameter()] [System.String] [ValidateSet('Automatic', 'Disabled', 'Manual')] @@ -1248,7 +1305,19 @@ function Set-TargetResource if ($Action -in @('Install')) { - $setupArguments += @{ AgtSvcStartupType = 'Automatic' } + if ($PSBoundParameters.ContainsKey('AgtSvcStartupType')) + { + $setupArguments.AgtSvcStartupType = $AgtSvcStartupType + } + else + { + $setupArguments += @{ AgtSvcStartupType = 'Automatic' } + } + + if ($PSBoundParameters.ContainsKey('SqlSvcStartupType')) + { + $setupArguments += @{ SqlSvcStartupType = $SqlSvcStartupType} + } } } @@ -1266,6 +1335,10 @@ function Set-TargetResource { $setupArguments += (Get-ServiceAccountParameters -ServiceAccount $RSSvcAccount -ServiceType 'RS') } + if ($PSBoundParameters.ContainsKey('RsSvcStartupType')) + { + $setupArguments += @{ RsSvcStartupType = $RsSvcStartupType} + } } if ($Features.Contains('AS')) @@ -1307,6 +1380,11 @@ function Set-TargetResource $setupArguments['ASSysAdminAccounts'] += $ASSysAdminAccounts } } + + if ($PSBoundParameters.ContainsKey('AsSvcStartupType')) + { + $setupArguments += @{ AsSvcStartupType = $AsSvcStartupType} + } } if ($Features.Contains('IS')) @@ -1315,6 +1393,11 @@ function Set-TargetResource { $setupArguments += (Get-ServiceAccountParameters -ServiceAccount $ISSvcAccount -ServiceType 'IS') } + + if ($PSBoundParameters.ContainsKey('IsSvcStartupType')) + { + $setupArguments += @{ IsSvcStartupType = $IsSvcStartupType} + } } # Automatically include any additional arguments @@ -1485,7 +1568,7 @@ function Set-TargetResource .PARAMETER Action The action to be performed. Default value is 'Install'. - Possible values are 'Install', 'InstallFailoverCluster', 'AddNode', 'PrepareFailoverCluster', and 'CompleteFailoverCluster' + Possible values are 'Install', 'InstallFailoverCluster', 'AddNode', 'PrepareFailoverCluster', and 'CompleteFailoverCluster'. .PARAMETER SourcePath The path to the root of the source files for installation. I.e and UNC path to a shared resource. Environment variables can be used in the path. @@ -1617,17 +1700,32 @@ function Set-TargetResource .PARAMETER ISSvcAccount Service account for Integration Services service. + .PARAMETER SqlSvcStartupType + Specifies the startup mode for SQL Server Engine service. + + .PARAMETER AgtSvcStartupType + Specifies the startup mode for SQL Server Agent service. + + .PARAMETER IsSvcStartupType + Specifies the startup mode for SQL Server Integration service. + + .PARAMETER AsSvcStartupType + Specifies the startup mode for SQL Server Analysis service. + + .PARAMETER RsSvcStartupType + Specifies the startup mode for SQL Server Report service. + .PARAMETER BrowserSvcStartupType - Specifies the startup mode for SQL Server Browser service + Specifies the startup mode for SQL Server Browser service. .PARAMETER FailoverClusterGroupName The name of the resource group to create for the clustered SQL Server instance. Default is 'SQL Server (InstanceName)'. .PARAMETER FailoverClusterIPAddress - Array of IP Addresses to be assigned to the clustered SQL Server instance + Array of IP Addresses to be assigned to the clustered SQL Server instance. .PARAMETER FailoverClusterNetworkName - Host name to be assigned to the clustered SQL Server instance + Host name to be assigned to the clustered SQL Server instance. .PARAMETER SetupProcessTimeout The timeout, in seconds, to wait for the setup process to finish. Default value is 7200 seconds (2 hours). If the setup process does not finish before this time, and error will be thrown. @@ -1801,6 +1899,31 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $ISSvcAccount, + [Parameter()] + [System.String] + [ValidateSet('Automatic', 'Disabled', 'Manual')] + $SqlSvcStartupType, + + [Parameter()] + [System.String] + [ValidateSet('Automatic', 'Disabled', 'Manual')] + $AgtSvcStartupType, + + [Parameter()] + [System.String] + [ValidateSet('Automatic', 'Disabled', 'Manual')] + $IsSvcStartupType, + + [Parameter()] + [System.String] + [ValidateSet('Automatic', 'Disabled', 'Manual')] + $AsSvcStartupType, + + [Parameter()] + [System.String] + [ValidateSet('Automatic', 'Disabled', 'Manual')] + $RsSvcStartupType, + [Parameter()] [System.String] [ValidateSet('Automatic', 'Disabled', 'Manual')] @@ -2035,10 +2158,10 @@ function Get-TemporaryFolder <# .SYNOPSIS - Returns the decimal representation of an IP Addresses + Returns the decimal representation of an IP Addresses. .PARAMETER IPAddress - The IP Address to be converted + The IP Address to be converted. #> function ConvertTo-Decimal { @@ -2063,16 +2186,16 @@ function ConvertTo-Decimal <# .SYNOPSIS - Determines whether an IP Address is valid for a given network / subnet + Determines whether an IP Address is valid for a given network / subnet. .PARAMETER IPAddress - IP Address to be checked + IP Address to be checked. .PARAMETER NetworkID - IP Address of the network identifier + IP Address of the network identifier. .PARAMETER SubnetMask - Subnet mask of the network to be checked + Subnet mask of the network to be checked. #> function Test-IPAddress { @@ -2103,13 +2226,13 @@ function Test-IPAddress <# .SYNOPSIS - Builds service account parameters for setup + Builds service account parameters for setup. .PARAMETER ServiceAccount - Credential for the service account + Credential for the service account. .PARAMETER ServiceType - Type of service account + Type of service account. #> function Get-ServiceAccountParameters { @@ -2168,7 +2291,7 @@ function Get-ServiceAccountParameters <# .SYNOPSIS - Starts the SQL setup process- + Starts the SQL setup process. .PARAMETER FilePath String containing the path to setup.exe. @@ -2210,4 +2333,28 @@ function Start-SqlSetupProcess return $sqlSetupProcess.ExitCode } +<# + .SYNOPSIS + Converts the start mode property returned by a Win32_Service CIM object to the resource properties *StartupType equivalent + + .PARAMETER StartMode + The StartMode to convert. +#> +function ConvertTo-StartupType +{ + param + ( + [Parameter()] + [System.String] + $StartMode + ) + + If ($StartMode -eq 'Auto') + { + $StartMode = 'Automatic' + } + + return $StartMode +} + Export-ModuleMember -Function *-TargetResource diff --git a/DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.schema.mof b/DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.schema.mof index c486ac153..88610edea 100644 --- a/DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.schema.mof +++ b/DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.schema.mof @@ -47,6 +47,11 @@ class MSFT_SqlSetup : OMI_BaseResource [Write, Description("The server mode for SQL Server Analysis Services instance. The default is to install in Multidimensional mode. Valid values in a cluster scenario are MULTIDIMENSIONAL or TABULAR. Parameter ASServerMode is case-sensitive. All values must be expressed in upper case."), ValueMap{"MULTIDIMENSIONAL", "TABULAR", "POWERPIVOT"}, Values{"MULTIDIMENSIONAL", "TABULAR", "POWERPIVOT"}] String ASServerMode; [Write, EmbeddedInstance("MSFT_Credential"), Description("Service account for Integration Services service.")] String ISSvcAccount; [Read, Description("Output username for the Integration Services service.")] String ISSvcAccountUsername; + [Write, Description("Specifies the startup mode for SQL Server Sql Engine service."), ValueMap{"Automatic", "Disabled", "Manual"}, Values{"Automatic", "Disabled", "Manual"}] String SqlSvcStartupType; + [Write, Description("Specifies the startup mode for SQL Server Sql Agent service."), ValueMap{"Automatic", "Disabled", "Manual"}, Values{"Automatic", "Disabled", "Manual"}] String AgtSvcStartupType; + [Write, Description("Specifies the startup mode for SQL Server Integration service."), ValueMap{"Automatic", "Disabled", "Manual"}, Values{"Automatic", "Disabled", "Manual"}] String IsSvcStartupType; + [Write, Description("Specifies the startup mode for SQL Server Analysis service."), ValueMap{"Automatic", "Disabled", "Manual"}, Values{"Automatic", "Disabled", "Manual"}] String AsSvcStartupType; + [Write, Description("Specifies the startup mode for SQL Server Report service."), ValueMap{"Automatic", "Disabled", "Manual"}, Values{"Automatic", "Disabled", "Manual"}] String RSSVCStartupType; [Write, Description("Specifies the startup mode for SQL Server Browser service."), ValueMap{"Automatic", "Disabled", "Manual"}, Values{"Automatic", "Disabled", "Manual"}] String BrowserSvcStartupType; [Write, Description("The name of the resource group to create for the clustered SQL Server instance. Default is 'SQL Server (InstanceName)'.")] String FailoverClusterGroupName; [Write, Description("Array of IP Addresses to be assigned to the clustered SQL Server instance.")] String FailoverClusterIPAddress[]; diff --git a/Examples/Resources/SqlSetup/6-InstallNamedInstanceSingleServerWithAgtSvcStartupTypeDisabled.ps1 b/Examples/Resources/SqlSetup/6-InstallNamedInstanceSingleServerWithAgtSvcStartupTypeDisabled.ps1 new file mode 100644 index 000000000..b412aa9e9 --- /dev/null +++ b/Examples/Resources/SqlSetup/6-InstallNamedInstanceSingleServerWithAgtSvcStartupTypeDisabled.ps1 @@ -0,0 +1,94 @@ +<# + .EXAMPLE + This example shows how to install a named instance of SQL Server on a single server. + + .NOTES + SQL Server setup is run using the SYSTEM account. Even if SetupCredential is provided + it is not used to install SQL Server at this time (see issue #139). +#> +Configuration Example +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNullorEmpty()] + [System.Management.Automation.PSCredential] + $SqlInstallCredential, + + [Parameter()] + [ValidateNotNullorEmpty()] + [System.Management.Automation.PSCredential] + $SqlAdministratorCredential = $SqlInstallCredential, + + [Parameter(Mandatory = $true)] + [ValidateNotNullorEmpty()] + [System.Management.Automation.PSCredential] + $SqlServiceCredential, + + [Parameter()] + [ValidateNotNullorEmpty()] + [System.Management.Automation.PSCredential] + $SqlAgentServiceCredential = $SqlServiceCredential + ) + + Import-DscResource -ModuleName SqlServerDSC + + node localhost + { + #region Install prerequisites for SQL Server + WindowsFeature 'NetFramework35' + { + Name = 'NET-Framework-Core' + Source = '\\fileserver.company.local\images$\Win2k12R2\Sources\Sxs' # Assumes built-in Everyone has read permission to the share and path. + Ensure = 'Present' + } + + WindowsFeature 'NetFramework45' + { + Name = 'NET-Framework-45-Core' + Ensure = 'Present' + } + #endregion Install prerequisites for SQL Server + + #region Install SQL Server + SqlSetup 'InstallNamedInstance-INST2016' + { + InstanceName = 'INST2016' + Features = 'SQLENGINE,AS' + SQLCollation = 'SQL_Latin1_General_CP1_CI_AS' + SQLSvcAccount = $SqlServiceCredential + AgtSvcAccount = $SqlAgentServiceCredential + ASSvcAccount = $SqlServiceCredential + SQLSysAdminAccounts = 'COMPANY\SQL Administrators', $SqlAdministratorCredential.UserName + ASSysAdminAccounts = 'COMPANY\SQL Administrators', $SqlAdministratorCredential.UserName + InstallSharedDir = 'C:\Program Files\Microsoft SQL Server' + InstallSharedWOWDir = 'C:\Program Files (x86)\Microsoft SQL Server' + InstanceDir = 'C:\Program Files\Microsoft SQL Server' + InstallSQLDataDir = 'C:\Program Files\Microsoft SQL Server\MSSQL13.INST2016\MSSQL\Data' + SQLUserDBDir = 'C:\Program Files\Microsoft SQL Server\MSSQL13.INST2016\MSSQL\Data' + SQLUserDBLogDir = 'C:\Program Files\Microsoft SQL Server\MSSQL13.INST2016\MSSQL\Data' + SQLTempDBDir = 'C:\Program Files\Microsoft SQL Server\MSSQL13.INST2016\MSSQL\Data' + SQLTempDBLogDir = 'C:\Program Files\Microsoft SQL Server\MSSQL13.INST2016\MSSQL\Data' + SQLBackupDir = 'C:\Program Files\Microsoft SQL Server\MSSQL13.INST2016\MSSQL\Backup' + ASConfigDir = 'C:\MSOLAP13.INST2016\Config' + ASDataDir = 'C:\MSOLAP13.INST2016\Data' + ASLogDir = 'C:\MSOLAP13.INST2016\Log' + ASBackupDir = 'C:\MSOLAP13.INST2016\Backup' + ASTempDir = 'C:\MSOLAP13.INST2016\Temp' + SourcePath = 'C:\InstallMedia\SQL2016RTM' + UpdateEnabled = 'False' + ForceReboot = $false + + SqlSvcStartupType = 'Automatic' + AgtSvcStartupType = 'Disabled' + AsSvcStartupType = 'Automatic' + BrowserSvcStartupType = 'Automatic' + + PsDscRunAsCredential = $SqlInstallCredential + + DependsOn = '[WindowsFeature]NetFramework35', '[WindowsFeature]NetFramework45' + } + #endregion Install SQL Server + } +} diff --git a/README.md b/README.md index 23b77c936..ce818a923 100644 --- a/README.md +++ b/README.md @@ -1633,8 +1633,18 @@ need a '*SVCPASSWORD' argument in the setup arguments. { MULTIDIMENSIONAL | TABULAR | POWERPIVOT }. * **`[PSCredential]` ISSvcAccount** _(Write)_: Service account for Integration Services service. +* **`[String]` SqlSvcStartupType** _(Write)_: Specifies the startup mode for + SQL Server Engine service. { Automatic | Disabled | Manual } +* **`[String]` AgtSvcStartupType** _(Write)_: Specifies the startup mode for + SQL Server Agent service. { Automatic | Disabled | Manual } +* **`[String]` AsSvcStartupType** _(Write)_: Specifies the startup mode for + SQL Server Analysis service. { Automatic | Disabled | Manual } +* **`[String]` IsSvcStartupType** _(Write)_: Specifies the startup mode for + SQL Server Integration service. { Automatic | Disabled | Manual } +* **`[String]` RsSvcStartupType** _(Write)_: Specifies the startup mode for + SQL Server Report service. { Automatic | Disabled | Manual } * **`[String]` BrowserSvcStartupType** _(Write)_: Specifies the startup mode for - SQL Server Browser service. { Automatic | Disabled | 'Manual' } + SQL Server Browser service. { Automatic | Disabled | Manual } * **`[String]` FailoverClusterGroupName** _(Write)_: The name of the resource group to create for the clustered SQL Server instance. Default is 'SQL Server (_InstanceName_)'. @@ -1670,6 +1680,7 @@ need a '*SVCPASSWORD' argument in the setup arguments. * [Install a named instance on a single server from an UNC path using SourceCredential](/Examples/Resources/SqlSetup/3-InstallNamedInstanceSingleServerFromUncPathUsingSourceCredential.ps1) * [Install a named instance as the first node in SQL Server Failover Cluster](/Examples/Resources/SqlSetup/4-InstallNamedInstanceInFailoverClusterFirstNode.ps1) * [Install a named instance as the second node in SQL Server Failover Cluster](/Examples/Resources/SqlSetup/5-InstallNamedInstanceInFailoverClusterSecondNode.ps1) +* [Install a named instance with the Agent Service set to Disabled](/Examples/Resources/SqlSetup/6-InstallNamedInstanceSingleServerWithAgtSvcStartupTypeDisabled.ps1) #### Known issues diff --git a/Tests/Integration/MSFT_SqlSetup.Integration.Tests.ps1 b/Tests/Integration/MSFT_SqlSetup.Integration.Tests.ps1 index 3a7fcd7e8..f542dc88d 100644 --- a/Tests/Integration/MSFT_SqlSetup.Integration.Tests.ps1 +++ b/Tests/Integration/MSFT_SqlSetup.Integration.Tests.ps1 @@ -251,6 +251,7 @@ try $resourceCurrentState.Action | Should -BeNullOrEmpty $resourceCurrentState.AgtSvcAccount | Should -BeNullOrEmpty $resourceCurrentState.AgtSvcAccountUsername | Should -Be ('.\{0}' -f (Split-Path -Path $mockSqlAgentServicePrimaryAccountUserName -Leaf)) + $resourceCurrentState.AgtSvcStartupType | Should -Be 'Automatic' $resourceCurrentState.ASServerMode | Should -Be $mockAnalysisServicesMultiServerMode $resourceCurrentState.ASBackupDir | Should -Be (Join-Path -Path $mockInstallSharedDir -ChildPath "MSAS13.$mockDatabaseEngineNamedInstanceName\OLAP\Backup") $resourceCurrentState.ASCollation | Should -Be $mockCollation @@ -260,6 +261,7 @@ try $resourceCurrentState.ASTempDir | Should -Be (Join-Path -Path $mockInstallSharedDir -ChildPath "MSAS13.$mockDatabaseEngineNamedInstanceName\OLAP\Temp") $resourceCurrentState.ASSvcAccount | Should -BeNullOrEmpty $resourceCurrentState.ASSvcAccountUsername | Should -Be ('.\{0}' -f (Split-Path -Path $mockSqlServicePrimaryAccountUserName -Leaf)) + $resourceCurrentState.AsSvcStartupType | Should -Be 'Automatic' $resourceCurrentState.ASSysAdminAccounts | Should -Be @( $mockSqlAdminAccountUserName, "NT SERVICE\SSASTELEMETRY`$$mockDatabaseEngineNamedInstanceName" @@ -293,6 +295,7 @@ try $resourceCurrentState.SQLCollation | Should -Be $mockCollation $resourceCurrentState.SQLSvcAccount | Should -BeNullOrEmpty $resourceCurrentState.SQLSvcAccountUsername | Should -Be ('.\{0}' -f (Split-Path -Path $mockSqlServicePrimaryAccountUserName -Leaf)) + $resourceCurrentState.SqlSvcStartupType | Should -Be 'Automatic' $resourceCurrentState.SQLSysAdminAccounts | Should -Be @( $mockSqlAdminAccountUserName, $mockSqlInstallAccountUserName, diff --git a/Tests/Integration/MSFT_SqlSetup.config.ps1 b/Tests/Integration/MSFT_SqlSetup.config.ps1 index fd42d9b29..aef829505 100644 --- a/Tests/Integration/MSFT_SqlSetup.config.ps1 +++ b/Tests/Integration/MSFT_SqlSetup.config.ps1 @@ -195,6 +195,8 @@ Configuration MSFT_SqlSetup_InstallDatabaseEngineNamedInstanceAsSystem_Config InstanceName = $Node.DatabaseEngineNamedInstanceName Features = $Node.DatabaseEngineNamedInstanceFeatures SourcePath = "$($Node.DriveLetter):\" + SqlSvcStartupType = 'Automatic' + AgtSvcStartupType = 'Automatic' BrowserSvcStartupType = 'Automatic' SecurityMode = 'SQL' SAPwd = $SqlAdministratorCredential @@ -202,6 +204,7 @@ Configuration MSFT_SqlSetup_InstallDatabaseEngineNamedInstanceAsSystem_Config SQLSvcAccount = $SqlServicePrimaryCredential AgtSvcAccount = $SqlAgentServicePrimaryCredential ASServerMode = $Node.AnalysisServicesMultiServerMode + AsSvcStartupType = 'Automatic' ASCollation = $Node.Collation ASSvcAccount = $SqlServicePrimaryCredential InstallSharedDir = $Node.InstallSharedDir diff --git a/Tests/Unit/MSFT_SqlSetup.Tests.ps1 b/Tests/Unit/MSFT_SqlSetup.Tests.ps1 index c13e57c57..f29cc5bff 100644 --- a/Tests/Unit/MSFT_SqlSetup.Tests.ps1 +++ b/Tests/Unit/MSFT_SqlSetup.Tests.ps1 @@ -105,7 +105,7 @@ try # Testing each supported SQL Server version $testProductVersion = @( - 14, # SQL Server "2017" + 14, # SQL Server 2017 13, # SQL Server 2016 12, # SQL Server 2014 11, # SQL Server 2012 @@ -177,6 +177,11 @@ try $mockAnalysisServicePassword = 'Analysiss3v!c3P@ssw0rd' $mockAnalysisServiceCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList @($mockAnalysisServiceAccount,($mockAnalysisServicePassword | ConvertTo-SecureString -AsPlainText -Force)) + $mockAgtSvcStartupMode = 'Auto' + $mockAsSvcStartupMode = 'Auto' + $mockIsSvcStartupMode = 'Auto' + $mockRsSvcStartupMode = 'Auto' + $mockClusterNodes = @($env:COMPUTERNAME,'SQL01','SQL02') $mockSqlDataDirectoryPath = 'E:\MSSQL\Data' @@ -274,7 +279,8 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockDefaultInstance_DatabaseServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockSqlSvcStartupMode -PassThru -Force ) ) } @@ -284,7 +290,8 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockDefaultInstance_AgentServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockAgentServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockAgentServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockAgtSvcStartupMode -PassThru -Force ) ) } @@ -294,7 +301,8 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockDefaultInstance_FullTextServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockSqlSvcStartupMode -PassThru -Force ) ) } @@ -304,7 +312,8 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockDefaultInstance_ReportingServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockSqlSvcStartupMode -PassThru -Force ) ) } @@ -314,7 +323,8 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value ($mockDefaultInstance_IntegrationServiceName -f $mockSqlMajorVersion) -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockSqlSvcStartupMode -PassThru -Force ) ) } @@ -324,7 +334,8 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockDefaultInstance_AnalysisServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockSqlSvcStartupMode -PassThru -Force ) ) } @@ -334,12 +345,14 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockDefaultInstance_DatabaseServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockSqlSvcStartupMode -PassThru -Force ), ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockDefaultInstance_AgentServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockAgentServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockAgentServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockAgtSvcStartupMode -PassThru -Force ), ( New-Object -TypeName Object | @@ -349,17 +362,20 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockDefaultInstance_ReportingServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockRsSvcStartupMode -PassThru -Force ), ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value ($mockDefaultInstance_IntegrationServiceName -f $mockSqlMajorVersion) -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockIsSvcStartupMode -PassThru -Force ), ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockDefaultInstance_AnalysisServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockAsSvcStartupMode -PassThru -Force ) ) } @@ -369,7 +385,8 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockNamedInstance_DatabaseServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockSqlSvcStartupMode -PassThru -Force ) ) } @@ -379,7 +396,8 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockNamedInstance_AgentServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockAgentServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockAgentServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockAgtSvcStartupMode -PassThru -Force ) ) } @@ -399,7 +417,8 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockNamedInstance_ReportingServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockRsSvcStartupMode -PassThru -Force ) ) } @@ -409,7 +428,8 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value ($mockNamedInstance_IntegrationServiceName -f $mockSqlMajorVersion) -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockIsSvcStartupMode -PassThru -Force ) ) } @@ -419,7 +439,8 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockNamedInstance_AnalysisServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockAsSvcStartupMode -PassThru -Force ) ) } @@ -429,12 +450,14 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockNamedInstance_DatabaseServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockSqlSvcStartupMode -PassThru -Force ), ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockNamedInstance_AgentServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockAgentServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockAgentServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockAgtSvcStartupMode -PassThru -Force ), ( New-Object -TypeName Object | @@ -444,17 +467,20 @@ try ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockNamedInstance_ReportingServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockRsSvcStartupMode -PassThru -Force ), ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value ($mockNamedInstance_IntegrationServiceName -f $mockSqlMajorVersion) -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockIsSvcStartupMode -PassThru -Force ), ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockNamedInstance_AnalysisServiceName -PassThru | - Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force + Add-Member -MemberType NoteProperty -Name 'StartName' -Value $mockSqlServiceAccount -PassThru -Force | + Add-Member -MemberType NoteProperty -Name 'StartMode' -Value $mockAsSvcStartupMode -PassThru -Force ) ) } @@ -931,6 +957,12 @@ try Features = $defaultFeatures } + $MockSqlSvcStartupType = 'Automatic' + $MockAgtSvcStartupType = 'Automatic' + $MockAsSvcStartupType = 'Automatic' + $MockIsSvcStartupType = 'Automatic' + $MockRsSvcStartupType = 'Automatic' + $mockDefaultClusterParameters = @{ SQLSysAdminAccounts = 'COMPANY\User1','COMPANY\SQLAdmins' @@ -1030,7 +1062,7 @@ try if ($mockSqlMajorVersion -in (13,14)) { - # Mock all SSMS products here to make sure we don't return any when testing SQL Server 2016 + # Mock all SSMS products here to make sure we don't return any when testing SQL Server 2016 and 2017 Mock -CommandName Get-ItemProperty -ParameterFilter { $Path -eq (Join-Path -Path $mockRegistryUninstallProductsPath -ChildPath $mockSqlServerManagementStudio2008R2_ProductIdentifyingNumber) -or $Path -eq (Join-Path -Path $mockRegistryUninstallProductsPath -ChildPath $mockSqlServerManagementStudio2012_ProductIdentifyingNumber) -or @@ -3101,6 +3133,11 @@ try UpdateEnabled = 'True' UpdateSource = 'C:\Updates\' # Regression test for issue #720 ASServerMode = 'TABULAR' + SqlSvcStartupType = $mockSqlSvcStartupType + AgtSvcStartupType = $mockAgtSvcStartupType + AsSvcStartupType = $mockAsSvcStartupType + IsSvcStartupType = $mockIsSvcStartupType + RsSvcStartupType = $mockRsSvcStartupType } if ( $mockSqlMajorVersion -in (13,14) ) @@ -3112,7 +3149,6 @@ try Quiet = 'True' IAcceptSQLServerLicenseTerms = 'True' Action = 'Install' - AGTSVCSTARTUPTYPE = 'Automatic' InstanceName = 'MSSQLSERVER' Features = $testParameters.Features SQLSysAdminAccounts = 'COMPANY\sqladmin COMPANY\SQLAdmins COMPANY\User1' @@ -3125,6 +3161,11 @@ try UpdateEnabled = 'True' UpdateSource = 'C:\Updates' # Regression test for issue #720 ASServerMode = 'TABULAR' + SqlSvcStartupType = $mockSqlSvcStartupType + AgtSvcStartupType = $mockAgtSvcStartupType + AsSvcStartupType = $mockAsSvcStartupType + IsSvcStartupType = $mockIsSvcStartupType + RsSvcStartupType = $mockRsSvcStartupType } { Set-TargetResource @testParameters } | Should -Not -Throw @@ -3159,7 +3200,7 @@ try if( $mockSqlMajorVersion -in (13,14) ) { - It 'Should throw when feature parameter contains ''SSMS'' when installing SQL Server 2016' { + It 'Should throw when feature parameter contains ''SSMS'' when installing SQL Server 2016 and 2017' { $testParameters += @{ InstanceName = $mockDefaultInstance_InstanceName SourceCredential = $null @@ -3172,7 +3213,7 @@ try { Set-TargetResource @testParameters } | Should -Throw "'SSMS' is not a valid value for setting 'FEATURES'. Refer to SQL Help for more information." } - It 'Should throw when feature parameter contains ''ADV_SSMS'' when installing SQL Server 2016' { + It 'Should throw when feature parameter contains ''ADV_SSMS'' when installing SQL Server 2016 and 2017' { $testParameters += @{ InstanceName = $mockDefaultInstance_InstanceName SourceCredential = $null @@ -3365,14 +3406,14 @@ try if( $mockSqlMajorVersion -in (13,14) ) { - It 'Should throw when feature parameter contains ''SSMS'' when installing SQL Server 2016' { + It 'Should throw when feature parameter contains ''SSMS'' when installing SQL Server 2016 and 2017' { $testParameters.Features = 'SSMS' $mockStartSqlSetupProcessExpectedArgument = '' { Set-TargetResource @testParameters } | Should -Throw "'SSMS' is not a valid value for setting 'FEATURES'. Refer to SQL Help for more information." } - It 'Should throw when feature parameter contains ''ADV_SSMS'' when installing SQL Server 2016' { + It 'Should throw when feature parameter contains ''ADV_SSMS'' when installing SQL Server 2016 and 2017' { $testParameters.Features = 'ADV_SSMS' $mockStartSqlSetupProcessExpectedArgument = '' @@ -3539,14 +3580,14 @@ try if( $mockSqlMajorVersion -in (13,14) ) { - It 'Should throw when feature parameter contains ''SSMS'' when installing SQL Server 2016' { + It 'Should throw when feature parameter contains ''SSMS'' when installing SQL Server 2016 and 2017' { $testParameters.Features = 'SSMS' $mockStartSqlSetupProcessExpectedArgument = @{} { Set-TargetResource @testParameters } | Should -Throw "'SSMS' is not a valid value for setting 'FEATURES'. Refer to SQL Help for more information." } - It 'Should throw when feature parameter contains ''ADV_SSMS'' when installing SQL Server 2016' { + It 'Should throw when feature parameter contains ''ADV_SSMS'' when installing SQL Server 2016 and 2017' { $testParameters.Features = 'ADV_SSMS' $mockStartSqlSetupProcessExpectedArgument = @{} @@ -3710,14 +3751,14 @@ try if( $mockSqlMajorVersion -in (13,14) ) { - It 'Should throw when feature parameter contains ''SSMS'' when installing SQL Server 2016' { + It 'Should throw when feature parameter contains ''SSMS'' when installing SQL Server 2016 and 2017' { $testParameters.Features = $($testParameters.Features), 'SSMS' -join ',' $mockStartSqlSetupProcessExpectedArgument = @{} { Set-TargetResource @testParameters } | Should -Throw "'SSMS' is not a valid value for setting 'FEATURES'. Refer to SQL Help for more information." } - It 'Should throw when feature parameter contains ''ADV_SSMS'' when installing SQL Server 2016' { + It 'Should throw when feature parameter contains ''ADV_SSMS'' when installing SQL Server 2016 and 2017' { $testParameters.Features = $($testParameters.Features), 'ADV_SSMS' -join ',' $mockStartSqlSetupProcessExpectedArgument = @{} From a5610ca20b49c011746e90bee1e237e9bf0774e2 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Fri, 31 Aug 2018 08:02:23 +0200 Subject: [PATCH 4/7] Fix change log after recent merge (#1211) --- CHANGELOG.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce824f0c7..3e0ae4b5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,14 @@ [Nick Reilingh (@NReilingh)](https://github.com/NReilingh) - Changes to SqlDatabaseOwner - BREAKING CHANGE: Support multiple instances on the same node. - The parameter InstanceName is now Key and cannot be omitted. + The parameter InstanceName is now Key and cannot be omitted ([issue #1197](https://github.com/PowerShell/SqlServerDsc/issues/1197)). +- Changes to SqlSetup + - Added new parameters to allow to define the startup types for the Sql Engine + service, the Agent service, the Analysis service and the Integration Service. + The new optional parameters are respectively SqlSvcStartupType, AgtSvcStartupType, + AsSvcStartupType, IsSvcStartupType and RsSvcStartupType ([issue #1165](https://github.com/PowerShell/SqlServerDsc/issues/1165). + [Maxime Daniou (@mdaniou)](https://github.com/mdaniou) ## 11.4.0.0 @@ -42,11 +48,6 @@ forced to be reimported into the session. This is to support that a never version of SQL Server was installed side-by-side so that SQLPS module should be used instead. - - Added new parameters to allow to define the startup types for the Sql Engine - service, the Agent service, the Analysis service and the Integration Service. - The new optional parameters are respectively SqlSvcStartupType, AgtSvcStartupType, - AsSvcStartupType, IsSvcStartupType and RsSvcStartupType. ([issue #1165](https://github.com/PowerShell/SqlServerDsc/issues/1165). - [Maxime Daniou (@mdaniou)](https://github.com/mdaniou) ## 11.3.0.0 From 32022b517c1e1d1f07fbd4dab094af25346ffcbb Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Fri, 31 Aug 2018 08:03:31 +0200 Subject: [PATCH 5/7] Add pull request template and issue templates (#1201) --- .github/ISSUE_TEMPLATE.md | 55 -------------- .github/ISSUE_TEMPLATE/General.md | 7 ++ .../ISSUE_TEMPLATE/Problem_with_resource.md | 73 +++++++++++++++++++ .github/ISSUE_TEMPLATE/Resource_proposal.md | 21 ++++++ .github/PULL_REQUEST_TEMPLATE.md | 53 +++++++------- 5 files changed, 126 insertions(+), 83 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/General.md create mode 100644 .github/ISSUE_TEMPLATE/Problem_with_resource.md create mode 100644 .github/ISSUE_TEMPLATE/Resource_proposal.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index adf71544d..000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,55 +0,0 @@ - -#### Details of the scenario you tried and the problem that is occurring - -#### The DSC configuration that is using the resource (as detailed as possible) -``` - -``` - -#### Version of the operating system and PowerShell the target node is running - - -#### SQL Server edition and version the target node is running - - -#### What SQL Server PowerShell modules, and which version, are present on the target node. - - -#### Version of the DSC module you're using, or write 'dev' if you're using current dev branch - diff --git a/.github/ISSUE_TEMPLATE/General.md b/.github/ISSUE_TEMPLATE/General.md new file mode 100644 index 000000000..fbcdf2405 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/General.md @@ -0,0 +1,7 @@ +--- +name: General question or documentation update +about: If you have a general question or documentation update suggestion around the resource module. +--- + diff --git a/.github/ISSUE_TEMPLATE/Problem_with_resource.md b/.github/ISSUE_TEMPLATE/Problem_with_resource.md new file mode 100644 index 000000000..f87ecb529 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Problem_with_resource.md @@ -0,0 +1,73 @@ +--- +name: Problem with a resource +about: If you have a problem, bug, or enhancement with a resource in this resource module. +--- + +#### Details of the scenario you tried and the problem that is occurring + +#### Verbose logs showing the problem + +#### Suggested solution to the issue + +#### The DSC configuration that is used to reproduce the issue (as detailed as possible) +```powershell +# insert configuration here +``` + +#### SQL Server edition and version the target node is running + + +#### SQL Server PowerShell modules present on the target node + + +#### The operating system the target node is running + + +#### Version and build of PowerShell the target node is running + + +#### Version of the DSC module that was used ('dev' if using current dev branch) + diff --git a/.github/ISSUE_TEMPLATE/Resource_proposal.md b/.github/ISSUE_TEMPLATE/Resource_proposal.md new file mode 100644 index 000000000..9f2a069a0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/Resource_proposal.md @@ -0,0 +1,21 @@ +--- +name: New resource proposal +about: If you have a new resource proposal that you think should be added to this resource module. +--- + +### Description + +### Proposed properties + +### Special considerations or limitations diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 5a677a5a6..a8b3c49df 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,48 +6,45 @@ at https://github.com/PowerShell/SqlServerDsc#contributing. Please prefix the PR title with the resource name, - i.e. 'SqlSetup: My short description'. + e.g. 'ResourceName: My short description'. If this is a breaking change, then also prefix the PR title with 'BREAKING CHANGE:', - i.e. 'BREAKING CHANGE: SqlSetup: My short description'. + e.g. 'BREAKING CHANGE: ResourceName: My short description'. - You may remove this and the other comments, but please keep the headers - and the task list. + You may remove this comment block, and the other comment blocks, but please + keep the headers and the task list. --> #### Pull Request (PR) description #### This Pull Request (PR) fixes the following issues #### Task list -- [ ] Added an entry under the Unreleased section in the CHANGELOG.md? Entry - should say what was changed, and how that affects users (if applicable). -- [ ] Resource documentation added/updated in README.md? +- [ ] Added an entry under the Unreleased section of the change log in the CHANGELOG.md. + Entry should say what was changed, and how that affects users (if applicable). +- [ ] Resource documentation added/updated in README.md. - [ ] Resource parameter descriptions added/updated in README.md, schema.mof - and comment-based help? -- [ ] Comment-based help added/updated? -- [ ] Localization strings added/updated in all localization files as appropriate? -- [ ] Examples appropriately added/updated? -- [ ] Unit tests added/updated? - See [DSC Resource Testing Guidelines](https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md). -- [ ] Integration tests added/updated (where possible)? - See [DSC Resource Testing Guidelines](https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md). -- [ ] New/changed code adheres to - [DSC Resource Style Guidelines](https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md) - and [Best Practices](https://github.com/PowerShell/DscResources/blob/master/BestPractices.md)? + and comment-based help. +- [ ] Comment-based help added/updated. +- [ ] Localization strings added/updated in all localization files as appropriate. +- [ ] Examples appropriately added/updated. +- [ ] Unit tests added/updated. See [DSC Resource Testing Guidelines](https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md). +- [ ] Integration tests added/updated (where possible). See [DSC Resource Testing Guidelines](https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md). +- [ ] New/changed code adheres to [DSC Resource Style Guidelines](https://github.com/PowerShell/DscResources/blob/master/StyleGuidelines.md) and [Best Practices](https://github.com/PowerShell/DscResources/blob/master/BestPractices.md). From 024ad37f357f1c78da5a06f866f755030a20bee8 Mon Sep 17 00:00:00 2001 From: Nick Reilingh Date: Fri, 31 Aug 2018 02:15:44 -0400 Subject: [PATCH 6/7] SqlServerDatabaseMail: Corrected and reorganized documentation (#1200) - Changes to SqlServerDatabaseMail - DisplayName is now properly treated as display name for the originating email address (issue #1200). - DisplayName property now defaults to email address instead of server name. - Minor improvements to documentation. --- CHANGELOG.md | 6 +++++ .../MSFT_SqlServerDatabaseMail.psm1 | 21 ++++++++-------- .../MSFT_SqlServerDatabaseMail.schema.mof | 6 ++--- README.md | 25 ++++++++++--------- 4 files changed, 32 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e0ae4b5a..1672c4902 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +- Changes to SqlServerDatabaseMail + - DisplayName is now properly treated as display name + for the originating email address ([issue #1200](https://github.com/PowerShell/SqlServerDsc/issue/1200)). + [Nick Reilingh (@NReilingh)](https://github.com/NReilingh) + - DisplayName property now defaults to email address instead of server name. + - Minor improvements to documentation. - Changes to SqlAGDatabase - Corrected reference to "PsDscRunAsAccount" in documentation ([issue #1199](https://github.com/PowerShell/SqlServerDsc/issues/1199)). diff --git a/DSCResources/MSFT_SqlServerDatabaseMail/MSFT_SqlServerDatabaseMail.psm1 b/DSCResources/MSFT_SqlServerDatabaseMail/MSFT_SqlServerDatabaseMail.psm1 index 037ffd3cd..abef48882 100644 --- a/DSCResources/MSFT_SqlServerDatabaseMail/MSFT_SqlServerDatabaseMail.psm1 +++ b/DSCResources/MSFT_SqlServerDatabaseMail/MSFT_SqlServerDatabaseMail.psm1 @@ -29,7 +29,7 @@ $script:localizedData = Get-LocalizedData -ResourceName 'MSFT_SqlServerDatabaseM sent. .PARAMETER ProfileName - The profile name of the Database Mail. + The name of the Database Mail profile. #> function Get-TargetResource { @@ -205,18 +205,18 @@ function Get-TargetResource sent. .PARAMETER ProfileName - The profile name of the Database Mail. + The name of the Database Mail profile. .PARAMETER DisplayName - The display name of the outgoing mail server. Default value is the same - value assigned to parameter MailServerName. + The display name of the originating e-mail address. + Default value is the same value assigned to the EmailAddress parameter. .PARAMETER ReplyToAddress The e-mail address to which the receiver of e-mails will reply to. Default value is the same e-mail address assigned to parameter EmailAddress. .PARAMETER Description - The description of the Database Mail. + The description for the Database Mail profile and account. .PARAMETER LoggingLevel The logging level that the Database Mail will use. If not specified the @@ -267,7 +267,7 @@ function Set-TargetResource [Parameter()] [System.String] - $DisplayName = $MailServerName, + $DisplayName = $EmailAddress, [Parameter()] [System.String] @@ -606,18 +606,17 @@ function Set-TargetResource sent. .PARAMETER ProfileName - The profile name of the Database Mail. + The name of the Database Mail profile. .PARAMETER DisplayName - The display name of the outgoing mail server. Default value is the same - value assigned to parameter MailServerName. + The display name of the originating e-mail address. .PARAMETER ReplyToAddress The e-mail address to which the receiver of e-mails will reply to. Default value is the same e-mail address assigned to parameter EmailAddress. .PARAMETER Description - The description of the Database Mail. + The description for the Database Mail profile and account. .PARAMETER LoggingLevel The logging level that the Database Mail will use. If not specified the @@ -664,7 +663,7 @@ function Test-TargetResource [Parameter()] [System.String] - $DisplayName = $MailServerName, + $DisplayName = $EmailAddress, [Parameter()] [System.String] diff --git a/DSCResources/MSFT_SqlServerDatabaseMail/MSFT_SqlServerDatabaseMail.schema.mof b/DSCResources/MSFT_SqlServerDatabaseMail/MSFT_SqlServerDatabaseMail.schema.mof index 35f803f30..a1e76a114 100644 --- a/DSCResources/MSFT_SqlServerDatabaseMail/MSFT_SqlServerDatabaseMail.schema.mof +++ b/DSCResources/MSFT_SqlServerDatabaseMail/MSFT_SqlServerDatabaseMail.schema.mof @@ -5,12 +5,12 @@ class MSFT_SqlServerDatabaseMail : OMI_BaseResource [Key, Description("The name of the SQL instance to be configured.")] String InstanceName; [Required, Description("The e-mail address from which mail will originate.")] String EmailAddress; [Required, Description("The fully qualified domain name of the mail server name to which e-mail are sent.")] String MailServerName; - [Required, Description("The profile name of the Database Mail.")] String ProfileName; + [Required, Description("The name of the Database Mail profile.")] String ProfileName; [Write, Description("Specifies the desired state of the Database Mail. When set to 'Present', the Database Mail will be created. When set to 'Absent', the Database Mail will be removed. Default value is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; [Write, Description("The hostname of the SQL Server to be configured. Defaults to $env:COMPUTERNAME.")] String ServerName; - [Write, Description("The display name of the outgoing mail server. Default value is the same value assigned to parameter MailServerName.")] String DisplayName; + [Write, Description("The display name of the originating email address. Default value is the same value assigned to the EmailAddress parameter.")] String DisplayName; [Write, Description("The e-mail address to which the receiver of e-mails will reply to. Default value is the same e-mail address assigned to parameter EmailAddress.")] String ReplyToAddress; - [Write, Description("The description of the Database Mail.")] String Description; + [Write, Description("The description for the Database Mail profile and account.")] String Description; [Write, Description("The logging level that the Database Mail will use. If not specified the default logging level is 'Extended'."), ValueMap{"Normal","Extended","Verbose"}, Values{"Normal","Extended","Verbose"}] String LoggingLevel; [Write, Description("The TCP port used for communication. Default value is port 25.")] UInt16 TcpPort; }; diff --git a/README.md b/README.md index ce818a923..d7e6cf55f 100644 --- a/README.md +++ b/README.md @@ -976,28 +976,29 @@ Resource to manage SQL Server Database Mail. #### Parameters * **`[String]` AccountName** _(Key)_: The name of the Database Mail account. +* **`[String]` ServerName** _(Write)_: The hostname of the SQL Server to be configured. + Defaults to $env:COMPUTERNAME. * **`[String]` InstanceName** _(Key)_: Name of the SQL instance to be configured. -* **`[String]` EmailAddress** _(Required)_: The e-mail address from which mail - will originate. -* **`[String]` MailServerName** _(Required)_: The fully qualified domain name of - the mail server name to which e-mail are sent. -* **`[String]` ProfileName** _(Required)_: The profile name of the Database Mail. * **`[String]` Ensure** _(Write)_: Specifies the desired state of the Database Mail. When set to 'Present', the Database Mail will be created. When set to 'Absent', the Database Mail will be removed. Default value is 'Present'. -* **`[String]` ServerName** _(Write)_: The hostname of the SQL Server to be configured. - Defaults to $env:COMPUTERNAME. -* **`[String]` DisplayName** _(Write)_: The display name of the outgoing mail server. - Default value is the same value assigned to parameter MailServerName. +* **`[String]` ProfileName** _(Required)_: The name of the Database Mail profile. +* **`[String]` Description** _(Write)_: The description for the Database Mail + profile and account. +* **`[String]` EmailAddress** _(Required)_: The e-mail address from which mail + will originate. +* **`[String]` DisplayName** _(Write)_: The display name of the originating e-mail + address. Default value is the same value assigned to the EmailAddress parameter. * **`[String]` ReplyToAddress** _(Write)_: The e-mail address to which the receiver of e-mails will reply to. Default value is the same e-mail address assigned to parameter EmailAddress. -* **`[String]` Description** _(Write)_: The description of the Database Mail. +* **`[String]` MailServerName** _(Required)_: The fully qualified domain name of + the mail server name to which e-mail are sent. +* **`[UInt16]` TcpPort** _(Write)_: The TCP port used for communication. Default + value is port 25. * **`[String]` LoggingLevel** _(Write)_: The logging level that the Database Mail will use. If not specified the default logging level is 'Extended'. { Normal | *Extended* | Verbose }. -* **`[UInt16]` TcpPort** _(Write)_: The TCP port used for communication. Default - value is port 25. #### Examples From 44f5af3a62e83907a7a5a21f2960526a3a69dca8 Mon Sep 17 00:00:00 2001 From: Katie Keim Date: Wed, 5 Sep 2018 10:22:06 -0700 Subject: [PATCH 7/7] Releasing version 12.0.0.0 --- CHANGELOG.md | 2 ++ SqlServerDsc.psd1 | 50 ++++++++++++++++++++--------------------------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1672c4902..cd8856b6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 12.0.0.0 + - Changes to SqlServerDatabaseMail - DisplayName is now properly treated as display name for the originating email address ([issue #1200](https://github.com/PowerShell/SqlServerDsc/issue/1200)). diff --git a/SqlServerDsc.psd1 b/SqlServerDsc.psd1 index ab6800ed2..1fa94ae13 100644 --- a/SqlServerDsc.psd1 +++ b/SqlServerDsc.psd1 @@ -1,6 +1,6 @@ @{ # Version number of this module. - moduleVersion = '11.4.0.0' + moduleVersion = '12.0.0.0' # ID used to uniquely identify this module GUID = '693ee082-ed36-45a7-b490-88b07c86b42f' @@ -49,35 +49,26 @@ # IconUri = '' # ReleaseNotes of this module - ReleaseNotes = '- Changes to SqlServerDsc - - Updated helper function Restart-SqlService to have to new optional parameters - `SkipClusterCheck` and `SkipWaitForOnline`. This was to support more aspects - of the resource SqlServerNetwork. - - Updated helper function `Import-SQLPSModule` - - To only import module if the - module does not exist in the session. - - To always import the latest version of "SqlServer" or "SQLPS" module, if - more than one version exist on the target node. It will still prefer to - use "SqlServer" module. - - Updated all the examples and integration tests to not use - `PSDscAllowPlainTextPassword`, so examples using credentials or - passwords by default are secure. -- Changes to SqlAlwaysOnService - - Integration tests was updated to handle new IPv6 addresses on the AppVeyor - build worker ([issue 1155](https://github.com/PowerShell/SqlServerDsc/issues/1155)). -- Changes to SqlServerNetwork - - Refactor SqlServerNetwork to not load assembly from GAC ([issue 1151](https://github.com/PowerShell/SqlServerDsc/issues/1151)). - - The resource now supports restarting the SQL Server service when both - enabling and disabling the protocol. - - Added integration tests for this resource - ([issue 751](https://github.com/PowerShell/SqlServerDsc/issues/751)). -- Changes to SqlAG - - Removed excess `Import-SQLPSModule` call. + ReleaseNotes = '- Changes to SqlServerDatabaseMail + - DisplayName is now properly treated as display name + for the originating email address ([issue 1200](https://github.com/PowerShell/SqlServerDsc/issue/1200)). + [Nick Reilingh (@NReilingh)](https://github.com/NReilingh) + - DisplayName property now defaults to email address instead of server name. + - Minor improvements to documentation. +- Changes to SqlAGDatabase + - Corrected reference to "PsDscRunAsAccount" in documentation + ([issue 1199](https://github.com/PowerShell/SqlServerDsc/issues/1199)). + [Nick Reilingh (@NReilingh)](https://github.com/NReilingh) +- Changes to SqlDatabaseOwner + - BREAKING CHANGE: Support multiple instances on the same node. + The parameter InstanceName is now Key and cannot be omitted + ([issue 1197](https://github.com/PowerShell/SqlServerDsc/issues/1197)). - Changes to SqlSetup - - Now after a successful install the "SQL PowerShell module" is reevaluated and - forced to be reimported into the session. This is to support that a never - version of SQL Server was installed side-by-side so that SQLPS module should - be used instead. + - Added new parameters to allow to define the startup types for the Sql Engine + service, the Agent service, the Analysis service and the Integration Service. + The new optional parameters are respectively SqlSvcStartupType, AgtSvcStartupType, + AsSvcStartupType, IsSvcStartupType and RsSvcStartupType ([issue 1165](https://github.com/PowerShell/SqlServerDsc/issues/1165). + [Maxime Daniou (@mdaniou)](https://github.com/mdaniou) ' @@ -101,3 +92,4 @@ +