From 67076671b295ef79ca29948da2bcc7135901ae04 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Mon, 2 Oct 2017 17:26:23 +0200 Subject: [PATCH] Changes to xSQLServerRSConfig - Added complete example for xSQLServerRSConfig (based on the integration tests) (issue #634). --- CHANGELOG.md | 2 + .../3-CompleteWithTwoInstances.ps1 | 139 ++++++++++++++++++ README.md | 1 + 3 files changed, 142 insertions(+) create mode 100644 Examples/Resources/xSQLServerRSConfig/3-CompleteWithTwoInstances.ps1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 433058f411..5a1536277f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,8 @@ - BREAKING CHANGE: Parameters RSSQLServer and RSSQLInstanceName has been renamed to DatabaseServerName and DatabaseInstanceName respectively ([issue #923](https://github.com/PowerShell/SqlServerDsc/issues/923)). + - Added complete example for SqlRS (based on the integration tests) + ([issue #634](https://github.com/PowerShell/xSQLServer/issues/634)). - Changes to SqlServerEndpointPermission - Now the examples files have a shorter name so that resources will not fail to compile in Azure Automation ([issue #934](https://github.com/PowerShell/SqlServerDsc/issues/934)). diff --git a/Examples/Resources/xSQLServerRSConfig/3-CompleteWithTwoInstances.ps1 b/Examples/Resources/xSQLServerRSConfig/3-CompleteWithTwoInstances.ps1 new file mode 100644 index 0000000000..9085d930e1 --- /dev/null +++ b/Examples/Resources/xSQLServerRSConfig/3-CompleteWithTwoInstances.ps1 @@ -0,0 +1,139 @@ +<# +.EXAMPLE + This example performs a default SSRS configuration. It will initialize SSRS + and register default Report Server Web Service and Report Manager URLs: + http://localhost:80/ReportServer (Report Server Web Service) + http://localhost:80/Reports (Report Manager) +#> + +$ConfigurationData = @{ + AllNodes = @( + @{ + NodeName = 'localhost' + + # This is values used for the Reporting Services instance. + InstanceName = 'RS' + Features = 'RS' + + # This is values used for the Database Engine instance. + RSSQLServer = $env:COMPUTERNAME + RSSQLInstanceName = 'RSDB' + RSSQLFeatures = 'SQLENGINE' + RSSQLCollation = 'Finnish_Swedish_CI_AS' + + # This is values used for both instances. + MediaPath = 'Z:\Sql2016Media' + InstallSharedDir = 'C:\Program Files\Microsoft SQL Server' + InstallSharedWOWDir = 'C:\Program Files (x86)\Microsoft SQL Server' + UpdateEnabled = 'False' + BrowserSvcStartupType = 'Automatic' + + PSDscAllowPlainTextPassword = $true + } + ) +} + +Configuration Example +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $SqlAdministratorCredential, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $SqlInstallCredential, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $SqlServiceCredential, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $SqlAgentServiceCredential, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $ReportingServicesServiceCredential + ) + + Import-DscResource -ModuleName xSqlServer + + node localhost { + WindowsFeature 'NetFramework45' + { + Name = 'NET-Framework-45-Core' + Ensure = 'Present' + } + + xSQLServerSetup 'InstallDatabaseEngine' + { + InstanceName = $Node.RSSQLInstanceName + Features = $Node.RSSQLFeatures + SourcePath = $Node.MediaPath + BrowserSvcStartupType = $Node.BrowserSvcStartupType + SQLCollation = $Node.RSSQLCollation + SQLSvcAccount = $SqlServiceCredential + AgtSvcAccount = $SqlAgentServiceCredential + InstallSharedDir = $Node.InstallSharedDir + InstallSharedWOWDir = $Node.InstallSharedWOWDir + UpdateEnabled = $Node.UpdateEnabled + + SQLSysAdminAccounts = @( + $SqlAdministratorCredential.UserName + ) + + DependsOn = @( + '[WindowsFeature]NetFramework45' + ) + + PsDscRunAsCredential = $SqlInstallCredential + } + + xSQLServerSetup 'InstallReportingServicesInstance' + { + InstanceName = $Node.InstanceName + Features = $Node.Features + SourcePath = $Node.MediaPath + BrowserSvcStartupType = $Node.BrowserSvcStartupType + RSSvcAccount = $ReportingServicesServiceCredential + InstallSharedDir = $Node.InstallSharedDir + InstallSharedWOWDir = $Node.InstallSharedWOWDir + UpdateEnabled = $Node.UpdateEnabled + + SQLSysAdminAccounts = @( + $SqlAdministratorCredential.UserName + ) + + DependsOn = @( + '[WindowsFeature]NetFramework45' + '[xSQLServerSetup]InstallDatabaseEngine' + ) + + PsDscRunAsCredential = $SqlInstallCredential + } + + xSQLServerRSConfig 'ConfigureReportingServiceInstance' + { + # Instance name for the Reporting Services. + InstanceName = $Node.InstanceName + + # Instance for Reporting Services databases. + RSSQLServer = $Node.RSSQLServer + RSSQLInstanceName = $Node.RSSQLInstanceName + + PsDscRunAsCredential = $SqlInstallCredential + + DependsOn = @( + '[xSQLServerSetup]InstallReportingServicesInstance' + ) + } + } +} diff --git a/README.md b/README.md index 42b2ea2d5a..0ebdeb6251 100644 --- a/README.md +++ b/README.md @@ -1221,6 +1221,7 @@ Initializes and configures SQL Reporting Services server. * [Default configuration](Examples/Resources/SqlRS/1-DefaultConfiguration.ps1) * [Custom virtual directories and reserved URLs](Examples/Resources/SqlRS/2-CustomConfiguration.ps1) +* [Complete example with two instances in default configuration](/Examples/Resources/SqlRS/3-CompleteWithTwoInstances.ps1) ### SqlRSSecureConnectionLevel