Skip to content

Commit

Permalink
SqlRS: New example based on integration test (dsccommunity#933)
Browse files Browse the repository at this point in the history
- Changes to SqlRS
  - Added complete example for SqlRS (based on the integration tests)
    (issue dsccommunity#634).
  • Loading branch information
johlju authored Jan 4, 2018
1 parent e45d6c1 commit cb085f0
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
- Refactored the resource to use Invoke-CimMethod.
- Added parameter UseSsl which when set to $true forces connections to the
Reporting Services to use SSL when connecting ([issue #990](https://github.com/PowerShell/SqlServerDsc/issues/990)).
- Added complete example for SqlRS (based on the integration tests)
([issue #634](https://github.com/PowerShell/SqlServerDsc/issues/634)).
- Changes to SqlServerNetwork
- Added sysadmin account parameter usage to the examples.
- Changes to SqlServerReplication
Expand Down
150 changes: 150 additions & 0 deletions Examples/Resources/SqlRS/4-CompleteWithTwoInstances.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
<#
.EXAMPLE
This example installs to instances where the first named instance is used for
the Reporting Services databases, and the second named instance is used for
Reporting Services. After installing the two instances, the configuration
performs a default SQL Server Reporting Services configuration. It will
initialize SQL Server Reporting Services and register the default
Report Server Web Service and Report Manager URLs:
Report Manager: http://localhost:80/Reports_RS
Report Server Web Service: http://localhost:80/ReportServer_RS
#>

$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.
DatabaseServerName = $env:COMPUTERNAME
DatabaseServerInstanceName = 'RSDB'
DatabaseServerFeatures = 'SQLENGINE'
DatabaseServerCollation = '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'

<#
NOTE! THIS IS NOT RECOMMENDED IN PRODUCTION.
This is added so that AppVeyor automatic tests can pass, otherwise
the tests will fail on passwords being in plain text and not being
encrypted. Because it is not possible to have a certificate in
AppVeyor to encrypt the passwords we need to add the parameter
'PSDscAllowPlainTextPassword'.
NOTE! THIS IS NOT RECOMMENDED IN PRODUCTION.
#>
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 PSDscResources
Import-DscResource -ModuleName SqlServerDsc

Node localhost {
WindowsFeature 'NetFramework45'
{
Name = 'NET-Framework-45-Core'
Ensure = 'Present'
}

SqlSetup 'InstallDatabaseEngine'
{
InstanceName = $Node.DatabaseServerInstanceName
Features = $Node.DatabaseServerFeatures
SourcePath = $Node.MediaPath
BrowserSvcStartupType = $Node.BrowserSvcStartupType
SQLCollation = $Node.DatabaseServerCollation
SQLSvcAccount = $SqlServiceCredential
AgtSvcAccount = $SqlAgentServiceCredential
InstallSharedDir = $Node.InstallSharedDir
InstallSharedWOWDir = $Node.InstallSharedWOWDir
UpdateEnabled = $Node.UpdateEnabled

SQLSysAdminAccounts = @(
$SqlAdministratorCredential.UserName
)

PsDscRunAsCredential = $SqlInstallCredential

DependsOn = @(
'[WindowsFeature]NetFramework45'
)
}

SqlSetup 'InstallReportingServicesInstance'
{
InstanceName = $Node.InstanceName
Features = $Node.Features
SourcePath = $Node.MediaPath
BrowserSvcStartupType = $Node.BrowserSvcStartupType
RSSvcAccount = $ReportingServicesServiceCredential
InstallSharedDir = $Node.InstallSharedDir
InstallSharedWOWDir = $Node.InstallSharedWOWDir
UpdateEnabled = $Node.UpdateEnabled

PsDscRunAsCredential = $SqlInstallCredential

DependsOn = @(
'[WindowsFeature]NetFramework45'
'[SqlSetup]InstallDatabaseEngine'
)
}

SqlRS 'ConfigureReportingServiceInstance'
{
# Instance name for the Reporting Services.
InstanceName = $Node.InstanceName

# Instance for Reporting Services databases.
DatabaseServerName = $Node.DatabaseServerName
DatabaseInstanceName = $Node.DatabaseServerInstanceName

PsDscRunAsCredential = $SqlInstallCredential

DependsOn = @(
'[SqlSetup]InstallReportingServicesInstance'
)
}
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,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)
* [Custom virtual directory and using SSL](Examples/Resources/SqlRS/3-CustomConfigurationUsingSsl.ps1)
* [Complete example with two instances in default configuration](/Examples/Resources/SqlRS/4-CompleteWithTwoInstances.ps1)

#### Known issues

Expand Down

0 comments on commit cb085f0

Please sign in to comment.