Skip to content

Parameterize Service Fabric Node Bootstrap service name in PatchIssuerThumbprints.ps1#317

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-c77fd6d9-a57d-4154-9107-378da5ed72b8
Draft

Parameterize Service Fabric Node Bootstrap service name in PatchIssuerThumbprints.ps1#317
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-c77fd6d9-a57d-4154-9107-378da5ed72b8

Conversation

Copy link
Copy Markdown

Copilot AI commented Aug 15, 2025

Summary

Enhanced the PatchIssuerThumbprints.ps1 script to support customizable Service Fabric Node Bootstrap Agent service names, addressing environments where the service is registered under a different name than the default ServiceFabricNodeBootstrapAgent.

Problem

The existing script had the Service Fabric Node Bootstrap Agent service name hard-coded as "ServiceFabricNodeBootstrapAgent" throughout the StopServiceFabricServices and StartServiceFabricServices helper functions. This prevented the script from working in environments with:

  • Customized Service Fabric installations
  • OEM images with different service naming
  • Future Service Fabric versions with naming changes

Changes Made

1. New Parameter

Added a new top-level script parameter with backward-compatible default:

[string]$bootstrapAgentServiceName = "ServiceFabricNodeBootstrapAgent"

2. Updated Documentation

Added comprehensive parameter documentation in the comment-based help:

.PARAMETER bootstrapAgentServiceName
    (New) The Windows service name of the Service Fabric Node Bootstrap Agent.
    Default: ServiceFabricNodeBootstrapAgent
    Override this if your environment uses a different service name.

3. Function Refactoring

Modified both service management functions to accept a mandatory parameter:

  • StopServiceFabricServices -BootstrapServiceName $bootstrapAgentServiceName
  • StartServiceFabricServices -BootstrapServiceName $bootstrapAgentServiceName

4. Defensive Error Handling

Added -ErrorAction SilentlyContinue to all Get-Service calls to gracefully handle scenarios where:

  • Custom service names are incorrect
  • Services are absent from the system
  • Prevents terminating errors that would halt script execution

5. Remote Execution Support

Updated all Invoke-Command calls to include the new parameter in their argument lists, ensuring the custom service name is properly passed to remote nodes.

Usage Examples

Original usage (backward compatible):

.\PatchIssuerThumbprints.ps1 -targetIssuerThumbprints "abc123,def456" -localOnly

With custom bootstrap service name:

.\PatchIssuerThumbprints.ps1 -targetIssuerThumbprints "abc123,def456" -bootstrapAgentServiceName "CustomBootstrapService" -localOnly

Remote execution with custom service:

.\PatchIssuerThumbprints.ps1 -targetIssuerThumbprints "abc123,def456" -nodeIpArray @("10.0.0.4","10.0.0.5") -bootstrapAgentServiceName "OEMBootstrapAgent"

Benefits

  • Environment Flexibility: Works with any Service Fabric bootstrap service name
  • Future-Proofing: Adapts to potential naming changes in future SF versions
  • Backward Compatibility: Existing automation continues to work unchanged
  • Error Resilience: Graceful handling of incorrect service names
  • Reduced Maintenance: Eliminates need to fork/modify script for custom environments

Testing

All changes have been validated for:

  • ✅ PowerShell syntax correctness
  • ✅ Backward compatibility preservation
  • ✅ Proper parameter defaults
  • ✅ Defensive error handling implementation
  • ✅ Complete hard-coded service name removal
  • ✅ Remote execution parameter passing

The script maintains full backward compatibility while enabling new customization scenarios.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…rThumbprints.ps1

Co-authored-by: LukeSlev <28886212+LukeSlev@users.noreply.github.com>
Copilot AI changed the title [WIP] Parameterize bootstrap service name in PatchIssuerThumbprints script Parameterize Service Fabric Node Bootstrap service name in PatchIssuerThumbprints.ps1 Aug 15, 2025
Copilot AI requested a review from LukeSlev August 15, 2025 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants