-
Notifications
You must be signed in to change notification settings - Fork 227
Add service account management for Reporting Services #2402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
8b8a28e
Add service account management for Reporting Services
johlju f161621
Enhance Set-SqlDscRSUrlReservation with Recreate mode and update tests
johlju 698125b
Refactor Get-SqlDscRSServiceAccount tests to simplify assertions and …
johlju 3579c5c
Update documentation for Get-SqlDscRSConfiguration to clarify CIM ins…
johlju e7d4cc1
Update parameter set in Set-SqlDscRSServiceAccount tests to include n…
johlju d9dcd41
Refactor tests for Set-SqlDscRSServiceAccount and Set-SqlDscRSUrlRese…
johlju d84e3ec
Add CommonTestHelper module import to BeforeAll in integration tests
johlju 633b587
Rename job 'Test_HQRM' to 'Test_QA' and add 'HQRM Test' job with arti…
johlju 7ba9c79
Split the `Test_HQRM` pipeline job into two parallel jobs (`Test_QA` …
johlju 087eff7
Add test to restart Reporting Services service after URL reservation …
johlju e8062d9
Add integration tests for database rights assignment and update servi…
johlju 72ec4ca
Refactor service account handling in database rights tests to use act…
johlju 3fe77af
Add test to create SQL Server login for new service account in databa…
johlju 19dd26e
Fix parameter usage in New-SqlDscLogin for granting database rights t…
johlju 6882dc3
Refactor database rights test to remove unnecessary error handling fo…
johlju 23430fd
Update dependencies for Reporting Services and BI Report Server integ…
johlju 3df8228
Add Get-SqlDscRSLogPath function and related tests for SQL Server Rep…
johlju 13a3722
Add integration tests for reinitializing Reporting Services after ser…
johlju 56f4c47
Enhance Request-SqlDscRSDatabaseRightsScript to validate UserName for…
johlju f1a6d52
Refactor error handling in Get-SqlDscRSLogPath function for improved …
johlju 413f09d
Enhance logging in Post.ServiceAccountChange.RS tests to include erro…
johlju b6bc2a1
Add New-SqlDscRSEncryptionKey and Remove-SqlDscRSEncryptionKey functi…
johlju 60532e2
Fix exception type for invalid UserName format in Request-SqlDscRSDat…
johlju 527ba0e
Enhance Remove-SqlDscRSEncryptionKey test to include encrypted inform…
johlju e322210
Enhance Remove-SqlDscRSEncryptionKey function to improve error handli…
johlju 7724eb7
Enhance Remove-SqlDscRSEncryptionKey tests to validate successful rem…
johlju 6b0e79f
Skip integration tests for SQL Server 2017 due to encryption key vali…
johlju 12dde57
Refactor error handling in encryption key functions and update integr…
johlju dd99447
Add wiki article for troubleshooting Power BI Report Server and SQL S…
johlju 4223ca2
Add troubleshooting guide for Power BI Report Server and SQL Server R…
johlju 765559b
Add Remove-SqlDscRSEncryptedInformation function and related tests; r…
johlju 1df2dcf
Refactor error handling in Remove-SqlDscRSEncryptedInformation and Re…
johlju 0b257fd
Add localization strings for Remove-SqlDscRSEncryptedInformation and …
johlju File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Gets the log file path for SQL Server Reporting Services or Power BI | ||
| Report Server. | ||
|
|
||
| .DESCRIPTION | ||
| Gets the log file folder path for SQL Server Reporting Services (SSRS) | ||
| or Power BI Report Server (PBIRS). The returned path is the ErrorDumpDirectory | ||
| from the instance's setup configuration, which contains the LogFiles folder | ||
| where service logs, portal logs, and memory dumps are stored. | ||
|
|
||
| The returned path can be used with `Get-ChildItem` and `Get-Content` to | ||
| access and read the log files. | ||
|
|
||
| Common log file types in this folder: | ||
| - ReportingServicesService*.log - Web service activity logs | ||
| - RSPortal*.log - Portal access and activity logs | ||
| - SQLDumpr*.mdmp - Memory dumps for error analysis | ||
|
|
||
| .PARAMETER InstanceName | ||
| Specifies the name of the Reporting Services instance. This is typically | ||
| 'SSRS' for SQL Server Reporting Services or 'PBIRS' for Power BI Report | ||
| Server. This parameter is mandatory when not passing a configuration object. | ||
|
|
||
| .PARAMETER Configuration | ||
| Specifies the `MSReportServer_ConfigurationSetting` CIM instance for | ||
| the Reporting Services instance. This can be obtained using the | ||
| `Get-SqlDscRSConfiguration` command. This parameter accepts pipeline | ||
| input. | ||
|
|
||
| .EXAMPLE | ||
| Get-SqlDscRSLogPath -InstanceName 'SSRS' | ||
|
|
||
| Returns the log file folder path for the SQL Server Reporting Services | ||
| instance 'SSRS'. | ||
|
|
||
| .EXAMPLE | ||
| Get-SqlDscRSLogPath -InstanceName 'PBIRS' | ||
|
|
||
| Returns the log file folder path for the Power BI Report Server | ||
| instance 'PBIRS'. | ||
|
|
||
| .EXAMPLE | ||
| Get-SqlDscRSConfiguration -InstanceName 'SSRS' | Get-SqlDscRSLogPath | ||
|
|
||
| Gets the configuration for SSRS and pipes it to Get-SqlDscRSLogPath to | ||
| retrieve the log folder path. | ||
|
|
||
| .EXAMPLE | ||
| Get-SqlDscRSLogPath -InstanceName 'SSRS' | Get-ChildItem -Filter '*.log' | ||
|
|
||
| Gets the log path for SSRS and lists all .log files in that folder. | ||
|
|
||
| .EXAMPLE | ||
| $logPath = Get-SqlDscRSLogPath -InstanceName 'SSRS' | ||
| Get-ChildItem -Path $logPath -Filter 'ReportingServicesService*.log' | | ||
| Sort-Object -Property LastWriteTime -Descending | | ||
| Select-Object -First 1 | | ||
| Get-Content -Tail 100 | ||
|
|
||
| Gets the most recent web service log file and displays the last 100 lines. | ||
|
|
||
| .INPUTS | ||
| `Microsoft.Management.Infrastructure.CimInstance` | ||
|
|
||
| Accepts MSReportServer_ConfigurationSetting CIM instance via pipeline. | ||
|
|
||
| .OUTPUTS | ||
| `System.String` | ||
|
|
||
| Returns the path to the log files folder for the specified Reporting | ||
| Services instance. | ||
| #> | ||
| function Get-SqlDscRSLogPath | ||
| { | ||
| [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('UseSyntacticallyCorrectExamples', '', Justification = 'Because the examples use pipeline input the rule cannot validate.')] | ||
| [CmdletBinding(DefaultParameterSetName = 'ByInstanceName')] | ||
| [OutputType([System.String])] | ||
| param | ||
| ( | ||
| [Parameter(Mandatory = $true, ParameterSetName = 'ByInstanceName')] | ||
| [System.String] | ||
| $InstanceName, | ||
|
|
||
| [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'ByConfiguration')] | ||
| [System.Object] | ||
| $Configuration | ||
| ) | ||
|
|
||
| process | ||
| { | ||
| if ($PSCmdlet.ParameterSetName -eq 'ByConfiguration') | ||
| { | ||
| $InstanceName = $Configuration.InstanceName | ||
| } | ||
|
|
||
| Write-Verbose -Message ($script:localizedData.Get_SqlDscRSLogPath_GettingPath -f $InstanceName) | ||
|
|
||
| $setupConfiguration = Get-SqlDscRSSetupConfiguration -InstanceName $InstanceName | ||
|
|
||
| if (-not $setupConfiguration) | ||
| { | ||
| $errorMessage = $script:localizedData.Get_SqlDscRSLogPath_InstanceNotFound -f $InstanceName | ||
|
|
||
| $errorRecord = New-ErrorRecord -Exception (New-InvalidOperationException -Message $errorMessage -PassThru) -ErrorId 'GSRSLP0001' -ErrorCategory 'ObjectNotFound' -TargetObject $InstanceName | ||
|
|
||
| $PSCmdlet.ThrowTerminatingError($errorRecord) | ||
| } | ||
|
|
||
| if ([System.String]::IsNullOrEmpty($setupConfiguration.ErrorDumpDirectory)) | ||
| { | ||
| $errorMessage = $script:localizedData.Get_SqlDscRSLogPath_LogPathNotFound -f $InstanceName | ||
|
|
||
| $errorRecord = New-ErrorRecord -Exception (New-InvalidOperationException -Message $errorMessage -PassThru) -ErrorId 'GSRSLP0002' -ErrorCategory 'ObjectNotFound' -TargetObject $InstanceName | ||
|
|
||
| $PSCmdlet.ThrowTerminatingError($errorRecord) | ||
| } | ||
|
|
||
| Write-Verbose -Message ($script:localizedData.Get_SqlDscRSLogPath_FoundPath -f $setupConfiguration.ErrorDumpDirectory) | ||
|
|
||
| return $setupConfiguration.ErrorDumpDirectory | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Gets the service account for SQL Server Reporting Services. | ||
|
|
||
| .DESCRIPTION | ||
| Gets the Windows service account for SQL Server Reporting Services or | ||
| Power BI Report Server from the `MSReportServer_ConfigurationSetting` | ||
| CIM instance. | ||
|
|
||
| This command returns the current service account name that is being | ||
| used by the Reporting Services Windows service. | ||
|
|
||
| The configuration CIM instance can be obtained using the | ||
| `Get-SqlDscRSConfiguration` command and passed via the pipeline. | ||
|
|
||
| .PARAMETER Configuration | ||
| Specifies the `MSReportServer_ConfigurationSetting` CIM instance for | ||
| the Reporting Services instance. This can be obtained using the | ||
| `Get-SqlDscRSConfiguration` command. This parameter accepts pipeline | ||
| input. | ||
|
|
||
| .EXAMPLE | ||
| Get-SqlDscRSConfiguration -InstanceName 'SSRS' | Get-SqlDscRSServiceAccount | ||
|
|
||
| Gets the service account for the Reporting Services instance 'SSRS'. | ||
|
|
||
| .EXAMPLE | ||
| $config = Get-SqlDscRSConfiguration -InstanceName 'SSRS' | ||
| Get-SqlDscRSServiceAccount -Configuration $config | ||
|
|
||
| Gets the service account using a stored configuration object. | ||
|
|
||
| .INPUTS | ||
| `Microsoft.Management.Infrastructure.CimInstance` | ||
|
|
||
| Accepts MSReportServer_ConfigurationSetting CIM instance via pipeline. | ||
|
|
||
| .OUTPUTS | ||
| `System.String` | ||
|
|
||
| Returns the service account name. | ||
|
|
||
| .NOTES | ||
| This is a convenience wrapper around accessing the | ||
| `WindowsServiceIdentityActual` property of the configuration CIM | ||
| instance. | ||
|
|
||
| .LINK | ||
| https://docs.microsoft.com/en-us/sql/reporting-services/wmi-provider-library-reference/msreportserver-configurationsetting-properties | ||
| #> | ||
| function Get-SqlDscRSServiceAccount | ||
| { | ||
| [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('UseSyntacticallyCorrectExamples', '', Justification = 'Because the examples use pipeline input the rule cannot validate.')] | ||
| [CmdletBinding()] | ||
| [OutputType([System.String])] | ||
| param | ||
| ( | ||
| [Parameter(Mandatory = $true, ValueFromPipeline = $true)] | ||
| [System.Object] | ||
| $Configuration | ||
| ) | ||
|
|
||
| process | ||
| { | ||
| $instanceName = $Configuration.InstanceName | ||
|
|
||
| Write-Verbose -Message ($script:localizedData.Get_SqlDscRSServiceAccount_Getting -f $instanceName) | ||
|
|
||
| return $Configuration.WindowsServiceIdentityActual | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.