Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d818f58
Add functions to manage report server database creation and permissions
johlju Jan 3, 2026
b9a3a66
Add System.ComponentModel.TypeConverter to referenced assemblies in S…
johlju Jan 3, 2026
7204a62
Fix comment-based help formatting and enhance QA tests for example co…
johlju Jan 3, 2026
a62b1a9
Fix comment-based help formatting by removing blank lines in example …
johlju Jan 3, 2026
ab8d82c
Fix comment-based help formatting by removing blank lines in example …
johlju Jan 3, 2026
ab908e1
Fix Reporting Services integration test tags and update README for cl…
johlju Jan 3, 2026
2b06005
Fix error handling in Invoke-RsCimMethod to provide descriptive fallb…
johlju Jan 3, 2026
d5f56cf
Fix error handling in Set-SqlDscRSDatabaseConnection by adding -Error…
johlju Jan 4, 2026
8a4938c
Refactor comment-based help structure tests by removing unused variab…
johlju Jan 4, 2026
c4fe9bf
Merge branch 'main' into f/issue-#2021
johlju Jan 4, 2026
6173d16
Add Get-HResultMessage function for translating HRESULT codes and enh…
johlju Jan 4, 2026
a077d47
Add Import-SqlDscPreferredModule to ensure SMO types are loaded in in…
johlju Jan 4, 2026
ed17306
Add "HRESULT" to cSpell words list for improved spell checking
johlju Jan 4, 2026
2cff608
Add notes to Get-HResultMessage function regarding error message reli…
johlju Jan 4, 2026
008e0fb
Enhance Request-SqlDscRSDatabaseScript to check if Reporting Services…
johlju Jan 4, 2026
3aa8e07
Refactor Request-SqlDscRSDatabaseRightsScript and related tests to re…
johlju Jan 4, 2026
a999afc
Refactor tests for Set-SqlDscRSDatabaseConnection to simplify asserti…
johlju Jan 4, 2026
4ce933b
Merge branch 'main' into f/issue-#2021
johlju Jan 4, 2026
a52e4f5
Refactor Set-TargetResource to use public commands for database scrip…
johlju Jan 4, 2026
3c854db
Enhance SqlRS tests by adding WindowsServiceIdentityActual property a…
johlju Jan 5, 2026
c8fbb1b
Update WindowsServiceIdentityActual property in Set-TargetResource te…
johlju Jan 5, 2026
695f3a0
Merge branch 'main' into f/issue-#2021
johlju Jan 5, 2026
fb786a9
`Initialize-SqlDscRS`: Add new command
johlju Jan 5, 2026
5b8244c
Merge branch 'main' into f/issue-#2014
johlju Jan 5, 2026
89f1909
Update CHANGELOG and improve error handling in Initialize-SqlDscRS; e…
johlju Jan 5, 2026
e58427a
Refactor tests to remove unnecessary script block usage in Initialize…
johlju Jan 5, 2026
3f6ccc7
Remove unused Invoke-RsCimMethod function and related tests from DSC_…
johlju Jan 5, 2026
0420110
Remove Invoke-CimMethod stubs and update tests to use Initialize-SqlD…
johlju Jan 5, 2026
1f424f8
Remove tests for Restart-ReportingServicesService to streamline unit …
johlju Jan 5, 2026
c506c98
Fix suppression message attribute in Restart-SqlDscRSService and Test…
johlju Jan 5, 2026
4e9090d
Remove cSpell ignore comment for PBIRS in various scripts and tests f…
johlju Jan 5, 2026
f3e3da2
Remove unnecessary blank line in Test-SqlDscRSInitialized function fo…
johlju Jan 5, 2026
4744e82
Add error handling for service retrieval in Restart-SqlDscRSService f…
johlju Jan 5, 2026
6c62609
Refactor parameter attributes in Restart-SqlDscRSService and update T…
johlju Jan 5, 2026
bd41d8a
Add unit tests for Request-SqlDscRSDatabaseUpgradeScript to validate …
johlju Jan 5, 2026
3524a42
Improve error handling in Request-SqlDscRSDatabaseUpgradeScript and u…
johlju Jan 5, 2026
488a2a9
Add tests for Configuration parameter attributes in Request-SqlDscRSD…
johlju Jan 5, 2026
56d0579
Add integration tests for Power BI Report Server package retrieval an…
johlju Jan 5, 2026
23a70b8
Improve error handling in Request-SqlDscRSDatabaseUpgradeScript by us…
johlju Jan 5, 2026
b2fd299
Enhance error handling in Request-SqlDscRSDatabaseUpgradeScript by in…
johlju Jan 5, 2026
ef8f9aa
Add integration test for Request-SqlDscRSDatabaseUpgradeScript and up…
johlju Jan 5, 2026
7cffa02
Fix error handling in Request-SqlDscRSDatabaseUpgradeScript by using …
johlju Jan 5, 2026
e438f1a
Remove unused service-related strings from English and Swedish locali…
johlju Jan 5, 2026
266edfc
Add DatabaseName and ServerVersion parameters to Request-SqlDscRSData…
johlju Jan 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added public command `Install-SqlDscFailoverCluster` to install SQL Server in
a failover cluster configuration. Extracted from `Install-SqlDscServer`
InstallFailoverCluster parameter set.
- Added public command `Restart-SqlDscRSService` to restart the Windows service
for SQL Server Reporting Services or Power BI Report Server. Supports waiting
for dependent services, configurable wait time, and accepts pipeline input
from `Get-SqlDscRSConfiguration`.
- Added public command `Test-SqlDscRSInitialized` to test whether a Reporting
Services instance is initialized by checking the `IsInitialized` property of
the configuration CIM instance
([issue #2014](https://github.com/dsccommunity/SqlServerDsc/issues/2014)).
- Added public command `Initialize-SqlDscRS` to initialize Reporting Services
by calling the `InitializeReportServer` CIM method. Used to complete initial
configuration after database and URL setup
([issue #2014](https://github.com/dsccommunity/SqlServerDsc/issues/2014)).

### Changed

Expand Down Expand Up @@ -210,6 +222,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([issue #2017](https://github.com/dsccommunity/SqlServerDsc/issues/2017))
([issue #2019](https://github.com/dsccommunity/SqlServerDsc/issues/2019))
([issue #2021](https://github.com/dsccommunity/SqlServerDsc/issues/2021)).
- Refactored to use the public command `Restart-SqlDscRSService` for restarting
the Reporting Services Windows service instead of calling the private
function `Restart-ReportingServicesService` directly.
- Refactored to use the public commands `Test-SqlDscRSInitialized` and
`Initialize-SqlDscRS` for checking and performing Reporting Services
initialization instead of accessing the `IsInitialized` property and
calling the CIM method directly
([issue #2014](https://github.com/dsccommunity/SqlServerDsc/issues/2014)).
- `Assert-SetupActionProperties`
- Refactored to use the command `Get-FileVersion` from the DscResource.Common
module instead of the private function `Get-FileVersionInformation`
Expand Down
9 changes: 9 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,11 @@ stages:
'tests/Integration/Commands/Remove-SqlDscRSUrlReservation.Integration.Tests.ps1'
'tests/Integration/Commands/Set-SqlDscRSUrlReservation.Integration.Tests.ps1'
'tests/Integration/Commands/Set-SqlDscRSDatabaseConnection.Integration.Tests.ps1'
'tests/Integration/Commands/Restart-SqlDscRSService.Integration.Tests.ps1'
'tests/Integration/Commands/Request-SqlDscRSDatabaseUpgradeScript.Integration.Tests.ps1'
'tests/Integration/Commands/Test-SqlDscRSInitialized.Integration.Tests.ps1'
# Group 4
'tests/Integration/Commands/Initialize-SqlDscRS.Integration.Tests.ps1'
# Group 8
'tests/Integration/Commands/Repair-SqlDscReportingService.Integration.Tests.ps1'
# Group 9
Expand Down Expand Up @@ -631,6 +636,10 @@ stages:
'tests/Integration/Commands/Remove-SqlDscRSUrlReservation.Integration.Tests.ps1'
'tests/Integration/Commands/Set-SqlDscRSUrlReservation.Integration.Tests.ps1'
'tests/Integration/Commands/Set-SqlDscRSDatabaseConnection.Integration.Tests.ps1'
'tests/Integration/Commands/Restart-SqlDscRSService.Integration.Tests.ps1'
'tests/Integration/Commands/Test-SqlDscRSInitialized.Integration.Tests.ps1'
# Group 4
'tests/Integration/Commands/Initialize-SqlDscRS.Integration.Tests.ps1'
# Group 8
'tests/Integration/Commands/Repair-SqlDscPowerBIReportServer.Integration.Tests.ps1'
# Group 9
Expand Down
98 changes: 6 additions & 92 deletions source/DSCResources/DSC_SqlRS/DSC_SqlRS.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function Get-TargetResource
$getTargetResourceResult.DatabaseInstanceName = 'MSSQLSERVER'
}

$isInitialized = $rsConfiguration.IsInitialized
$isInitialized = $rsConfiguration | Test-SqlDscRSInitialized

[System.Boolean] $getTargetResourceResult.IsInitialized = $isInitialized

Expand Down Expand Up @@ -348,7 +348,7 @@ function Set-TargetResource
$language = $wmiOperatingSystem.OSLanguage
$restartReportingService = $false

if (-not $rsConfiguration.IsInitialized)
if (-not ($rsConfiguration | Test-SqlDscRSInitialized))
{
Write-Verbose -Message "Initializing Reporting Services on $DatabaseServerName\$DatabaseInstanceName."

Expand Down Expand Up @@ -456,7 +456,7 @@ function Set-TargetResource
#>
Write-Verbose -Message $script:localizedData.RestartToFinishInitialization

Restart-ReportingServicesService -ServiceName $reportingServicesServiceName -WaitTime 30
Restart-SqlDscRSService -ServiceName $reportingServicesServiceName -WaitTime 30 -Force

<#
Wait for the service to be fully ready after restart before attempting
Expand All @@ -481,7 +481,7 @@ function Set-TargetResource
InitializeReportServer will fail on SQL Server Standard and
lower editions.
#>
if (-not $rsConfiguration.IsInitialized)
if (-not ($rsConfiguration | Test-SqlDscRSInitialized))
{
Write-Verbose -Message "Did not help restarting the Reporting Services service, running the CIM method to initialize report server on $DatabaseServerName\$DatabaseInstanceName for instance ID '$($rsConfiguration.InstallationID)'."

Expand All @@ -498,15 +498,7 @@ function Set-TargetResource

$restartReportingService = $true

$invokeRsCimMethodParameters = @{
CimInstance = $rsConfiguration
MethodName = 'InitializeReportServer'
Arguments = @{
InstallationId = $rsConfiguration.InstallationID
}
}

Invoke-RsCimMethod @invokeRsCimMethodParameters -ErrorAction 'Stop'
$rsConfiguration | Initialize-SqlDscRS -Force -ErrorAction 'Stop'
}
else
{
Expand Down Expand Up @@ -646,7 +638,7 @@ function Set-TargetResource
elseif ( $restartReportingService -and (-not $SuppressRestart) )
{
Write-Verbose -Message $script:localizedData.Restart
Restart-ReportingServicesService -ServiceName $reportingServicesServiceName -WaitTime 30
Restart-SqlDscRSService -ServiceName $reportingServicesServiceName -WaitTime 30 -Force

<#
Wait for the service to be fully ready after restart before attempting
Expand Down Expand Up @@ -850,81 +842,3 @@ function Test-TargetResource

$result
}

<#
.SYNOPSIS
A wrapper for Invoke-CimMethod to be able to handle errors in one place.

.PARAMETER CimInstance
The CIM instance object that contains the method to call.

.PARAMETER MethodName
The method to call in the CIM Instance object.

.PARAMETER Arguments
The arguments that should be
#>
function Invoke-RsCimMethod
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('AvoidThrowOutsideOfTry', '', Justification = 'Because the code throws based on an prior expression')]
[CmdletBinding()]
[OutputType([Microsoft.Management.Infrastructure.CimMethodResult])]
param
(

[Parameter(Mandatory = $true)]
[Microsoft.Management.Infrastructure.CimInstance]
$CimInstance,

[Parameter(Mandatory = $true)]
[System.String]
$MethodName,

[Parameter()]
[System.Collections.Hashtable]
$Arguments
)

$invokeCimMethodParameters = @{
MethodName = $MethodName
ErrorAction = 'Stop'
}

if ($PSBoundParameters.ContainsKey('Arguments'))
{
$invokeCimMethodParameters['Arguments'] = $Arguments
}

$invokeCimMethodResult = $CimInstance | Invoke-CimMethod @invokeCimMethodParameters

<#
Successfully calling the method returns $invokeCimMethodResult.HRESULT -eq 0.
If an general error occur in the Invoke-CimMethod, like calling a method
that does not exist, returns $null in $invokeCimMethodResult.

cSpell: ignore HRESULT
#>
if ($invokeCimMethodResult -and $invokeCimMethodResult.HRESULT -ne 0)
{
if ($invokeCimMethodResult | Get-Member -Name 'ExtendedErrors')
{
<#
The returned object property ExtendedErrors is an array
so that needs to be concatenated.
#>
$errorMessage = $invokeCimMethodResult.ExtendedErrors -join ';'
}
else
{
$errorMessage = $invokeCimMethodResult.Error
}

throw 'Method {0}() failed with an error. Error: {1} (HRESULT:{2})' -f @(
$MethodName
$errorMessage
$invokeCimMethodResult.HRESULT
)
}

return $invokeCimMethodResult
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
'Connect-SQLAnalysis'
'Get-SqlInstanceMajorVersion'
'Restart-SqlService'
'Restart-ReportingServicesService'
'Update-AvailabilityGroupReplica'
'Test-LoginEffectivePermissions'
'Test-AvailabilityReplicaSeedingModeAutomatic'
Expand Down
58 changes: 0 additions & 58 deletions source/Modules/SqlServerDsc.Common/SqlServerDsc.Common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1128,64 +1128,6 @@ function Restart-SqlClusterService
}
}

<#
.SYNOPSIS
Restarts a Reporting Services instance and associated services

.PARAMETER ServiceName
Name of the service to be restarted.

.PARAMETER WaitTime
Number of seconds to wait between service stop and service start.
Default value is 0 seconds.
#>
function Restart-ReportingServicesService
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[System.String]
$ServiceName,

[Parameter()]
[System.UInt16]
$WaitTime = 0
)

Write-Verbose -Message ($script:localizedData.GetServiceInformation -f $ServiceName) -Verbose
$reportingServicesService = Get-Service -Name $ServiceName

<#
Get all dependent services that are running.
There are scenarios where an automatic service is stopped and should
not be restarted automatically.
#>
$dependentService = $reportingServicesService.DependentServices | Where-Object -FilterScript {
$_.Status -eq 'Running'
}

Write-Verbose -Message ($script:localizedData.RestartService -f $reportingServicesService.DisplayName) -Verbose

Write-Verbose -Message ($script:localizedData.StoppingService -f $reportingServicesService.DisplayName) -Verbose
$reportingServicesService | Stop-Service -Force

if ($WaitTime -ne 0)
{
Write-Verbose -Message ($script:localizedData.WaitServiceRestart -f $WaitTime, $reportingServicesService.DisplayName) -Verbose
Start-Sleep -Seconds $WaitTime
}

Write-Verbose -Message ($script:localizedData.StartingService -f $reportingServicesService.DisplayName) -Verbose
$reportingServicesService | Start-Service

# Start dependent services
$dependentService | ForEach-Object -Process {
Write-Verbose -Message ($script:localizedData.StartingDependentService -f $_.DisplayName) -Verbose
$_ | Start-Service
}
}

<#
.SYNOPSIS
Executes the alter method on an Availability Group Replica object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ ConvertFrom-StringData @'
BringSqlServerAgentClusterResourcesOnline = Bringing the SQL Server Agent resource online. (SQLCOMMON0036)
GetServiceInformation = Getting information about service '{0}'. (SQLCOMMON0037)
RestartService = '{0}' service is restarting. (SQLCOMMON0038)
StoppingService = '{0}' service is stopping. (SQLCOMMON0039)
StartingService = '{0}' service is starting. (SQLCOMMON0040)
WaitServiceRestart = Waiting {0} seconds before starting service '{1}'. (SQLCOMMON0041)
StartingDependentService = Starting service '{0}'. (SQLCOMMON0042)
WaitingInstanceTimeout = Waiting for instance {0}\\{1} to report status online, with a timeout value of {2} seconds. (SQLCOMMON0043)
FailedToConnectToInstanceTimeout = Failed to connect to the instance {0}\\{1} within the timeout period of {2} seconds. (SQLCOMMON0044)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ ConvertFrom-StringData @'
BringSqlServerAgentClusterResourcesOnline = Tar SQL Server Agent resurser online. (SQLCOMMON0036)
GetServiceInformation = Hämtar information om SQL Server-tjänst '{0}'. (SQLCOMMON0037)
RestartService = '{0}' service is restarting. (SQLCOMMON0038)
StoppingService = '{0}' service is stopping. (SQLCOMMON0039)
StartingService = '{0}' service is starting. (SQLCOMMON0040)
WaitServiceRestart = Waiting {0} seconds before starting service '{1}'. (SQLCOMMON0041)
StartingDependentService = Startar tjänst {0} (SQLCOMMON0042)
WaitingInstanceTimeout = Waiting for instance {0}\\{1} to report status online, with a timeout value of {2} seconds. (SQLCOMMON0043)
FailedToConnectToInstanceTimeout = Failed to connect to the instance {0}\\{1} within the timeout period of {2} seconds. (SQLCOMMON0044)
Expand Down
1 change: 0 additions & 1 deletion source/Public/Get-SqlDscRSConfiguration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#>
function Get-SqlDscRSConfiguration
{
# cSpell: ignore PBIRS
[CmdletBinding()]
[OutputType([Microsoft.Management.Infrastructure.CimInstance])]
param
Expand Down
1 change: 0 additions & 1 deletion source/Public/Get-SqlDscRSPackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#>
function Get-SqlDscRSPackage
{
# cSpell: ignore PBIRS
[CmdletBinding()]
[OutputType([System.Diagnostics.FileVersionInfo])]
param
Expand Down
1 change: 0 additions & 1 deletion source/Public/Get-SqlDscRSSetupConfiguration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#>
function Get-SqlDscRSSetupConfiguration
{
# cSpell: ignore PBIRS
[CmdletBinding()]
[OutputType([PSCustomObject[]])]
param
Expand Down
1 change: 0 additions & 1 deletion source/Public/Get-SqlDscRSUrlReservation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#>
function Get-SqlDscRSUrlReservation
{
# cSpell: ignore PBIRS
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('UseSyntacticallyCorrectExamples', '', Justification = 'Because the examples use pipeline input the rule cannot validate.')]
[CmdletBinding()]
[OutputType([Microsoft.Management.Infrastructure.CimMethodResult])]
Expand Down
Loading
Loading