Skip to content

Commit f2d7347

Browse files
committed
Do not enforce reserved URLs when not supplied.
1 parent 4f9b533 commit f2d7347

File tree

3 files changed

+133
-125
lines changed

3 files changed

+133
-125
lines changed

source/DSCResources/DSC_SqlRS/DSC_SqlRS.psm1

Lines changed: 118 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,10 @@ function Get-TargetResource
238238
Report Manager/Report Web App virtual directory name. Optional.
239239
240240
.PARAMETER ReportServerReservedUrl
241-
Report Server URL reservations. Optional. If not specified,
242-
'http://+:80' URL reservation will be used.
241+
Report Server URL reservations. Optional.
243242
244243
.PARAMETER ReportsReservedUrl
245-
Report Manager/Report Web App URL reservations. Optional.
246-
If not specified, 'http://+:80' URL reservation will be used.
244+
Report Manager/Report Web App URL reservations.
247245
248246
.PARAMETER HttpsCertificateThumbprint
249247
The thumbprint of the certificate used to secure SSL communication.
@@ -361,11 +359,11 @@ function Set-TargetResource
361359

362360
[Parameter()]
363361
[System.String[]]
364-
$ReportServerReservedUrl = @('http://+:80'),
362+
$ReportServerReservedUrl,
365363

366364
[Parameter()]
367365
[System.String[]]
368-
$ReportsReservedUrl = @('http://+:80'),
366+
$ReportsReservedUrl,
369367

370368
[Parameter()]
371369
[System.String]
@@ -798,97 +796,103 @@ function Set-TargetResource
798796
#endregion Virtual Directories
799797

800798
#region Reserved URLs
801-
$compareParameters = @{
802-
ReferenceObject = $currentConfig.ReportServerReservedUrl
803-
DifferenceObject = $ReportServerReservedUrl
804-
}
805-
806-
if ( ($null -ne $ReportServerReservedUrl) -and ($null -ne (Compare-Object @compareParameters)) )
799+
if ( $PSBoundParameters.ContainsKey('EncryptionKeyBackupPath') )
807800
{
808-
$restartReportingService = $true
801+
$compareParameters = @{
802+
ReferenceObject = $currentConfig.ReportServerReservedUrl
803+
DifferenceObject = $ReportServerReservedUrl
804+
}
809805

810-
$currentConfig.ReportServerReservedUrl | ForEach-Object -Process {
811-
$invokeRsCimMethodParameters = @{
812-
CimInstance = $reportingServicesData.Configuration
813-
MethodName = 'RemoveURL'
814-
Arguments = @{
815-
Application = 'ReportServerWebService'
816-
UrlString = $_
817-
Lcid = $language
806+
if ( ($null -ne $ReportServerReservedUrl) -and ($null -ne (Compare-Object @compareParameters)) )
807+
{
808+
$restartReportingService = $true
809+
810+
$currentConfig.ReportServerReservedUrl | ForEach-Object -Process {
811+
$invokeRsCimMethodParameters = @{
812+
CimInstance = $reportingServicesData.Configuration
813+
MethodName = 'RemoveURL'
814+
Arguments = @{
815+
Application = 'ReportServerWebService'
816+
UrlString = $_
817+
Lcid = $language
818+
}
818819
}
819-
}
820820

821-
Invoke-RsCimMethod @invokeRsCimMethodParameters
822-
}
821+
Invoke-RsCimMethod @invokeRsCimMethodParameters
822+
}
823823

824-
$ReportServerReservedUrl | ForEach-Object -Process {
825-
Write-Verbose -Message "Adding report server URL reservation on $DatabaseServerName\$DatabaseInstanceName`: $_."
826-
$invokeRsCimMethodParameters = @{
827-
CimInstance = $reportingServicesData.Configuration
828-
MethodName = 'ReserveUrl'
829-
Arguments = @{
830-
Application = 'ReportServerWebService'
831-
UrlString = $_
832-
Lcid = $language
824+
$ReportServerReservedUrl | ForEach-Object -Process {
825+
Write-Verbose -Message "Adding report server URL reservation on $DatabaseServerName\$DatabaseInstanceName`: $_."
826+
$invokeRsCimMethodParameters = @{
827+
CimInstance = $reportingServicesData.Configuration
828+
MethodName = 'ReserveUrl'
829+
Arguments = @{
830+
Application = 'ReportServerWebService'
831+
UrlString = $_
832+
Lcid = $language
833+
}
833834
}
835+
836+
Invoke-RsCimMethod @invokeRsCimMethodParameters
834837
}
835838

836-
Invoke-RsCimMethod @invokeRsCimMethodParameters
839+
# Get the current configuration
840+
$currentConfig = Get-TargetResource @getTargetResourceParameters
841+
Write-Verbose -Message ( $script:localizedData.ReportingServicesIsInitialized -f $DatabaseServerName, $DatabaseInstanceName, $currentConfig.IsInitialized ) -Verbose
837842
}
838-
839-
# Get the current configuration
840-
$currentConfig = Get-TargetResource @getTargetResourceParameters
841-
Write-Verbose -Message ( $script:localizedData.ReportingServicesIsInitialized -f $DatabaseServerName, $DatabaseInstanceName, $currentConfig.IsInitialized ) -Verbose
842843
}
843844

844-
$compareParameters = @{
845-
ReferenceObject = $currentConfig.ReportsReservedUrl
846-
DifferenceObject = $ReportsReservedUrl
847-
}
848-
849-
if ( ($null -ne $ReportsReservedUrl) -and ($null -ne (Compare-Object @compareParameters)) )
845+
if ( $PSBoundParameters.ContainsKey('ReportsReservedUrl') )
850846
{
851-
$restartReportingService = $true
847+
$compareParameters = @{
848+
ReferenceObject = $currentConfig.ReportsReservedUrl
849+
DifferenceObject = $ReportsReservedUrl
850+
}
852851

853-
$currentConfig.ReportsReservedUrl | ForEach-Object -Process {
854-
$invokeRsCimMethodParameters = @{
855-
CimInstance = $reportingServicesData.Configuration
856-
MethodName = 'RemoveURL'
857-
Arguments = @{
858-
Application = $reportingServicesData.ReportsApplicationName
859-
UrlString = $_
860-
Lcid = $language
852+
if ( ($null -ne $ReportsReservedUrl) -and ($null -ne (Compare-Object @compareParameters)) )
853+
{
854+
$restartReportingService = $true
855+
856+
$currentConfig.ReportsReservedUrl | ForEach-Object -Process {
857+
$invokeRsCimMethodParameters = @{
858+
CimInstance = $reportingServicesData.Configuration
859+
MethodName = 'RemoveURL'
860+
Arguments = @{
861+
Application = $reportingServicesData.ReportsApplicationName
862+
UrlString = $_
863+
Lcid = $language
864+
}
861865
}
862-
}
863866

864-
Invoke-RsCimMethod @invokeRsCimMethodParameters
865-
}
867+
Invoke-RsCimMethod @invokeRsCimMethodParameters
868+
}
866869

867-
$ReportsReservedUrl | ForEach-Object -Process {
868-
Write-Verbose -Message (
869-
$script:localizedData.AddReportsUrlReservation -f @(
870-
$DatabaseServerName
871-
$DatabaseInstanceName
872-
$_
870+
$ReportsReservedUrl | ForEach-Object -Process {
871+
Write-Verbose -Message (
872+
$script:localizedData.AddReportsUrlReservation -f @(
873+
$DatabaseServerName
874+
$DatabaseInstanceName
875+
$_
876+
)
873877
)
874-
)
875878

876-
$invokeRsCimMethodParameters = @{
877-
CimInstance = $reportingServicesData.Configuration
878-
MethodName = 'ReserveUrl'
879-
Arguments = @{
880-
Application = $reportingServicesData.ReportsApplicationName
881-
UrlString = $_
882-
Lcid = $language
879+
$invokeRsCimMethodParameters = @{
880+
CimInstance = $reportingServicesData.Configuration
881+
MethodName = 'ReserveUrl'
882+
Arguments = @{
883+
Application = $reportingServicesData.ReportsApplicationName
884+
UrlString = $_
885+
Lcid = $language
886+
}
883887
}
888+
889+
Invoke-RsCimMethod @invokeRsCimMethodParameters
884890
}
885891

886-
Invoke-RsCimMethod @invokeRsCimMethodParameters
892+
# Get the current configuration
893+
$currentConfig = Get-TargetResource @getTargetResourceParameters
894+
Write-Verbose -Message ( $script:localizedData.ReportingServicesIsInitialized -f $DatabaseServerName, $DatabaseInstanceName, $currentConfig.IsInitialized ) -Verbose
887895
}
888-
889-
# Get the current configuration
890-
$currentConfig = Get-TargetResource @getTargetResourceParameters
891-
Write-Verbose -Message ( $script:localizedData.ReportingServicesIsInitialized -f $DatabaseServerName, $DatabaseInstanceName, $currentConfig.IsInitialized ) -Verbose
892896
}
893897
#endregion Reserved URLs
894898

@@ -1198,12 +1202,10 @@ function Set-TargetResource
11981202
Report Manager/Report Web App virtual directory name. Optional.
11991203
12001204
.PARAMETER ReportServerReservedUrl
1201-
Report Server URL reservations. Optional. If not specified,
1202-
'http://+:80' URL reservation will be used.
1205+
Report Server URL reservations. Optional.
12031206
12041207
.PARAMETER ReportsReservedUrl
12051208
Report Manager/Report Web App URL reservations. Optional.
1206-
If not specified, 'http://+:80' URL reservation will be used.
12071209
12081210
.PARAMETER HttpsCertificateThumbprint
12091211
The thumbprint of the certificate used to secure SSL communication.
@@ -1285,11 +1287,11 @@ function Test-TargetResource
12851287

12861288
[Parameter()]
12871289
[System.String[]]
1288-
$ReportServerReservedUrl = @('http://+:80'),
1290+
$ReportServerReservedUrl,
12891291

12901292
[Parameter()]
12911293
[System.String[]]
1292-
$ReportsReservedUrl = @('http://+:80'),
1294+
$ReportsReservedUrl,
12931295

12941296
[Parameter()]
12951297
[System.String]
@@ -1382,50 +1384,56 @@ function Test-TargetResource
13821384
$result = $false
13831385
}
13841386

1385-
if ( $null -eq $currentConfig.ReportServerReservedUrl )
1386-
{
1387-
Write-Verbose -Message (
1388-
$script:localizedData.ReportServerReservedUrlNotInDesiredState -f $DatabaseServerName, $DatabaseInstanceName, '', ( $ReportServerReservedUrl -join ', ' )
1389-
) -Verbose
1390-
$result = $false
1391-
}
1392-
else
1387+
if ( $PSBoundParameters.ContainsKey('ReportServerReservedUrl') )
13931388
{
1394-
$compareParameters = @{
1395-
ReferenceObject = $currentConfig.ReportServerReservedUrl
1396-
DifferenceObject = $ReportServerReservedUrl
1397-
}
1398-
1399-
if ( $null -ne ( Compare-Object @compareParameters ) )
1389+
if ( $null -eq $currentConfig.ReportServerReservedUrl )
14001390
{
14011391
Write-Verbose -Message (
1402-
$script:localizedData.ReportServerReservedUrlNotInDesiredState -f $DatabaseServerName, $DatabaseInstanceName, $($currentConfig.ReportServerReservedUrl -join ', '), ( $ReportServerReservedUrl -join ', ' )
1392+
$script:localizedData.ReportServerReservedUrlNotInDesiredState -f $DatabaseServerName, $DatabaseInstanceName, '', ( $ReportServerReservedUrl -join ', ' )
14031393
) -Verbose
14041394
$result = $false
14051395
}
1406-
}
1396+
else
1397+
{
1398+
$compareParameters = @{
1399+
ReferenceObject = $currentConfig.ReportServerReservedUrl
1400+
DifferenceObject = $ReportServerReservedUrl
1401+
}
14071402

1408-
if ( $null -eq $currentConfig.ReportsReservedUrl )
1409-
{
1410-
Write-Verbose -Message (
1411-
$script:localizedData.ReportsReservedUrlNotInDesiredState -f $DatabaseServerName, $DatabaseInstanceName, '', ( $ReportsReservedUrl -join ', ' )
1412-
) -Verbose
1413-
$result = $false
1414-
}
1415-
else
1416-
{
1417-
$compareParameters = @{
1418-
ReferenceObject = $currentConfig.ReportsReservedUrl
1419-
DifferenceObject = $ReportsReservedUrl
1403+
if ( $null -ne ( Compare-Object @compareParameters ) )
1404+
{
1405+
Write-Verbose -Message (
1406+
$script:localizedData.ReportServerReservedUrlNotInDesiredState -f $DatabaseServerName, $DatabaseInstanceName, $($currentConfig.ReportServerReservedUrl -join ', '), ( $ReportServerReservedUrl -join ', ' )
1407+
) -Verbose
1408+
$result = $false
1409+
}
14201410
}
1411+
}
14211412

1422-
if ( $null -ne ( Compare-Object @compareParameters ) )
1413+
if ( $PSBoundParameters.ContainsKey('ReportsReservedUrl') )
1414+
{
1415+
if ( $null -eq $currentConfig.ReportsReservedUrl )
14231416
{
14241417
Write-Verbose -Message (
1425-
$script:localizedData.ReportsReservedUrlNotInDesiredState -f $DatabaseServerName, $DatabaseInstanceName, ( $currentConfig.ReportsReservedUrl -join ', ' ), ( $ReportsReservedUrl -join ', ' )
1418+
$script:localizedData.ReportsReservedUrlNotInDesiredState -f $DatabaseServerName, $DatabaseInstanceName, '', ( $ReportsReservedUrl -join ', ' )
14261419
) -Verbose
14271420
$result = $false
14281421
}
1422+
else
1423+
{
1424+
$compareParameters = @{
1425+
ReferenceObject = $currentConfig.ReportsReservedUrl
1426+
DifferenceObject = $ReportsReservedUrl
1427+
}
1428+
1429+
if ( $null -ne ( Compare-Object @compareParameters ) )
1430+
{
1431+
Write-Verbose -Message (
1432+
$script:localizedData.ReportsReservedUrlNotInDesiredState -f $DatabaseServerName, $DatabaseInstanceName, ( $currentConfig.ReportsReservedUrl -join ', ' ), ( $ReportsReservedUrl -join ', ' )
1433+
) -Verbose
1434+
$result = $false
1435+
}
1436+
}
14291437
}
14301438

14311439
if ($PSBoundParameters.ContainsKey('UseSsl') -and $UseSsl -ne $currentConfig.UseSsl)

source/DSCResources/DSC_SqlRS/DSC_SqlRS.schema.mof

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class DSC_SqlRS : OMI_BaseResource
99
[Write, EmbeddedInstance("MSFT_Credential"), Description("The service account that should be used when running the _Windows_ service.")] String ServiceAccount;
1010
[Write, Description("_Report Server Web Service_ virtual directory. Optional.")] String ReportServerVirtualDirectory;
1111
[Write, Description("_Report Manager_ or _Report Web App_ virtual directory name. Optional.")] String ReportsVirtualDirectory;
12-
[Write, Description("_Report Server_ URL reservations. Optional. If not specified, `'http://+:80'` URL reservation will be used.")] String ReportServerReservedUrl[];
13-
[Write, Description("_Report Manager_ or _Report Web App_ URL reservations. Optional. If not specified, `'http://+:80'` URL reservation will be used.")] String ReportsReservedUrl[];
12+
[Write, Description("_Report Server_ URL reservations. Optional.")] String ReportServerReservedUrl[];
13+
[Write, Description("_Report Manager_ or _Report Web App_ URL reservations. Optional.")] String ReportsReservedUrl[];
1414
[Write, Description("The thumbprint of the certificate used to secure SSL communication.")] String HttpsCertificateThumbprint;
1515
[Write, Description("The IP address to bind the certificate specified in the _CertificateThumbprint_ parameter to. Default is `0.0.0.0` which binds to all IP addresses.")] String HttpsIPAddress;
1616
[Write, Description("The port used for SSL communication. Default is `443`.")] SInt32 HttpsPort;

0 commit comments

Comments
 (0)