Auto-rebind co-located SSRS from Install-SqlServerCertificate.ps1 #4

Merged
hannah-vernon merged 1 commit from feature/install-auto-ssrs-rebind into dev 2026-08-25 14:40:46 -05:00

What does this PR do?

Makes Install-SqlServerCertificate.ps1 rebind co-located SQL Server Reporting
Services (SSRS) as part of a certificate renewal, so a single run handles the
whole machine instead of remembering to run the two scripts separately.

After the SQL Server certificate work completes, the script detects SSRS (the
SQLServerReportingServices service or the SSRS Setup registry key) and, if
present, rebinds it to the just-imported certificate by invoking the companion
Update-SsrsCertificate.ps1 from $PSScriptRoot with the imported thumbprint.

Behavior:

  • Auto-detect and prompt by default. -UpdateSsrs rebinds without prompting
    (unattended); -SkipSsrs suppresses it. The two switches are mutually exclusive.
  • -RestartSqlServer also restarts the SSRS service (passes -RestartReportServer
    to the child script).
  • Under -WhatIf the installer returns at its ShouldProcess gate before
    importing, so the SSRS rebind is listed as a planned action but the child script
    is not invoked (the certificate is not yet in the store).
  • An SSRS rebind failure is reported but does not unwind the completed SQL Server
    certificate install.
  • Non-interactive hosts without -UpdateSsrs skip the rebind with guidance.

Documentation (README.md, AGENT-README.md) updated to match.

Fixes #

How was this tested?

  • PowerShell parser validation passes ([Parser]::ParseFile() returns no errors)
  • Verified the SSRS detection signals and the interactive prompt objects
    construct correctly.
  • End-to-end run pending on a UAT server (the installer prompts for the PFX
    password interactively, so a full unattended run was not exercised in the
    authoring environment). Both UAT servers are already renewed, so a real run
    there should rebind SQL and reach the SSRS step as a no-op.

Checklist

  • I have read the Contributing Guide
  • Changes are focused - one logical change per PR
  • Script runs cleanly under Set-StrictMode -Version Latest
  • State-changing actions honor -WhatIf via SupportsShouldProcess
  • Documentation updated (if user-visible behavior changed)
  • No commented-out code or debug leftovers
  • No real certificates, keys, or infrastructure names committed
## What does this PR do? Makes `Install-SqlServerCertificate.ps1` rebind co-located SQL Server Reporting Services (SSRS) as part of a certificate renewal, so a single run handles the whole machine instead of remembering to run the two scripts separately. After the SQL Server certificate work completes, the script detects SSRS (the `SQLServerReportingServices` service or the SSRS `Setup` registry key) and, if present, rebinds it to the just-imported certificate by invoking the companion `Update-SsrsCertificate.ps1` from `$PSScriptRoot` with the imported thumbprint. Behavior: - Auto-detect and **prompt** by default. `-UpdateSsrs` rebinds without prompting (unattended); `-SkipSsrs` suppresses it. The two switches are mutually exclusive. - `-RestartSqlServer` also restarts the SSRS service (passes `-RestartReportServer` to the child script). - Under `-WhatIf` the installer returns at its `ShouldProcess` gate before importing, so the SSRS rebind is listed as a planned action but the child script is not invoked (the certificate is not yet in the store). - An SSRS rebind failure is reported but does not unwind the completed SQL Server certificate install. - Non-interactive hosts without `-UpdateSsrs` skip the rebind with guidance. Documentation (`README.md`, `AGENT-README.md`) updated to match. Fixes # ## How was this tested? - [x] PowerShell parser validation passes (`[Parser]::ParseFile()` returns no errors) - [x] Verified the SSRS detection signals and the interactive prompt objects construct correctly. - [ ] End-to-end run pending on a UAT server (the installer prompts for the PFX password interactively, so a full unattended run was not exercised in the authoring environment). Both UAT servers are already renewed, so a real run there should rebind SQL and reach the SSRS step as a no-op. ## Checklist - [x] I have read the [Contributing Guide](../CONTRIBUTING.md) - [x] Changes are focused - one logical change per PR - [x] Script runs cleanly under `Set-StrictMode -Version Latest` - [x] State-changing actions honor `-WhatIf` via `SupportsShouldProcess` - [x] Documentation updated (if user-visible behavior changed) - [x] No commented-out code or debug leftovers - [x] No real certificates, keys, or infrastructure names committed
After the SQL Server certificate work completes, detect SQL Server
Reporting Services on the same machine (SQLServerReportingServices service
or the SSRS Setup registry key) and rebind it to the just-imported
certificate by invoking the companion Update-SsrsCertificate.ps1 from
$PSScriptRoot with the imported thumbprint.

Behavior:
- Auto-detect and prompt by default; -UpdateSsrs rebinds without prompting
  for unattended runs, -SkipSsrs suppresses it. The two switches are
  mutually exclusive.
- -RestartSqlServer also restarts the SSRS service (passes
  -RestartReportServer to the child).
- Under -WhatIf the installer returns at its ShouldProcess gate before
  importing, so the SSRS rebind is listed as a planned action but the child
  script is not invoked (the certificate is not yet in the store).
- A failure of the SSRS rebind is reported but does not unwind the
  completed SQL Server certificate install.
- Non-interactive hosts without -UpdateSsrs skip the rebind with guidance.

Documentation (README.md, AGENT-README.md) updated to match.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hannah-vernon/Install-SqlServerCertificate!4
No description provided.