Harden BizTalk maintenance workflow and add installer

This commit is contained in:
2026-08-06 18:46:28 +02:00
parent e8df6042d2
commit 0cb3fda151
32 changed files with 1782 additions and 565 deletions
+81 -63
View File
@@ -1,87 +1,105 @@
# BizTalk Platform Management Tool
WinForms tool for controlled Microsoft BizTalk Server 2020 platform operations during maintenance windows. The tool captures runtime snapshots, creates shutdown and restore plans, executes those plans in a safe order, and writes diff reports for validation.
Grafisches .NET-Werkzeug für kontrollierte Wartungsfenster einer Microsoft
BizTalk-Server-2020-Umgebung. Es erfasst den Laufzeitzustand, fährt ausschließlich
die zuvor aktiven Artefakte in sicherer Reihenfolge herunter und startet nach
dem Patchen ausschließlich diese Artefakte wieder.
## Current State
## Wichtigste Eigenschaften
- Application: C# WinForms
- Target framework: .NET Framework 4.6.1
- Solution: `BizTalkPlatformManagementTool.sln`
- Project: `src/BizTalkPlatformManagementTool/BizTalkPlatformManagementTool.csproj`
- Primary namespace and assembly: `BizTalkPlatformManagementTool`
- Legacy PowerShell archive: `archive/powershell/BizTalkPlatformManagementTool.ps1`
- übersichtliche deutschsprachige WinForms-Oberfläche mit klarer Sechs-Schritt-Führung
- Dry-run standardmäßig aktiv
- Vorher-Snapshot als verbindliche Wiederherstellungsgrundlage
- vorhandener Vorher-Snapshot wird beim Herunterfahren nicht überschrieben
- servergebundene Validierung verhindert die Verwendung einer Zustandsdatei für den falschen BizTalk-Server
- Receive Locations, Send Ports, Orchestrierungen und Hostinstanzen
- kontrollierte Reihenfolge mit Zustandsprüfung und konfigurierbarem Timeout
- nur vorher aktive Artefakte werden heruntergefahren und wieder gestartet
- WMI-Objekte werden eindeutig aufgelöst; mehrdeutige Treffer führen sicher zum Abbruch
- wiederholbare Ausführung: bereits erreichte Zielzustände werden übersprungen
- atomar geschriebene JSON-Dateien mit Größenbegrenzung
- keine Transport-URIs, Benutzernamen oder Kennwörter im Snapshot
- CSV-/HTML-Berichte und Vorher-/Nachher-Vergleich
- tägliche Logs unter `%ProgramData%\BizTalkPlatformManagementTool\Logs`
- eigenständiger .NET-Installer für Installation, Update und Deinstallation
- ZIP-, SHA-256- und Base64-TXT-Paket werden beim Release-Build erzeugt
## Features
## Sicherer Wartungsablauf
- Snapshot before and after downtime as JSON, CSV and HTML
- Diff between `before.json` and `after.json`
- Controlled shutdown from the current runtime state
- Controlled restore from `before.json`
- Host instance handling for the selected BizTalk server
- Dry-run mode enabled by default
- WMI access through `root\MicrosoftBizTalkServer`
- Startup check for administrator rights
- Detailed operation logging in the GUI and daily rolling log files next to the executable
- Environment status indicator based on host instance state
- Clear and Close actions in the main toolbar
- No compile-time dependency on BizTalk ExplorerOM assemblies
1. Tool als Administrator starten.
2. Zielserver und Arbeitsordner prüfen.
3. **Verbindung prüfen** ausführen.
4. Mit aktiviertem Dry-run **Zustand erfassen**.
5. **Herunterfahren** im Dry-run ausführen und `shutdown-plan.json` prüfen.
6. Dry-run deaktivieren und **Herunterfahren** bestätigen.
7. Server manuell patchen.
8. Dieselbe Vorher-Zustandsdatei auswählen.
9. **Wiederherstellen** zunächst im Dry-run prüfen und danach real ausführen.
10. **Nachher erfassen** und **Vergleichen**.
## Safe Usage
Die Zustandsdatei ist sicherheitskritisch: Sie definiert exakt, welche
Artefakte wieder gestartet werden. Bewusst gestoppte, gebundene oder
deaktivierte Artefakte bleiben beim Restore unangetastet.
1. Start the app with **Run as administrator** on a BizTalk server or a management host with WMI access.
2. Keep **Dry run** enabled.
3. Click **Diagnose** to verify WMI access.
4. Click **Snapshot Before**.
5. Click **Shutdown** and review `shutdown-plan.json`.
6. Disable **Dry run** only when the plan is correct.
7. After maintenance, click **Restore** using the saved `before.json`.
8. Click **Snapshot After** and **Compare**.
## Reihenfolge
The environment indicator shows `Started`, `Stopped`, `Partial` or `Unknown` from the most recent snapshot. `Clear` removes the visible status and operation log grids; it does not delete files.
Herunterfahren:
The application checks administrator rights during startup. If it is not elevated, it shows an error message and exits because BizTalk WMI operations require an elevated administrator process.
1. zuvor aktivierte Receive Locations deaktivieren
2. zuvor gestartete Orchestrierungen stoppen
3. zuvor gestartete Send Ports stoppen
4. zuvor gestartete Hostinstanzen des ausgewählten Servers stoppen
## Operation Order
Wiederherstellen:
Shutdown:
- Disable receive locations that were enabled.
- Stop orchestrations that were started.
- Stop send ports that were started.
- Stop host instances that were started on the selected server.
1. zuvor gestartete Hostinstanzen des ausgewählten Servers starten
2. zuvor gestartete Send Ports starten
3. zuvor gestartete Orchestrierungen starten
4. zuvor aktivierte Receive Locations zuletzt aktivieren
Restore:
- Start host instances that were previously started.
- Restore send ports to Started, Stopped or Bound.
- Restore orchestrations where safe.
- Restore receive locations last.
## Dateien
Orchestrations that were `Bound` are deliberately left unchanged during restore to avoid accidentally making them `Unbound`.
Standard-Arbeitsbereich:
## Outputs
```text
%ProgramData%\BizTalkPlatformManagementTool\
Wartungen\
Wartungsstatus-YYYYMMDD-HHmmss.json
shutdown-plan.json
shutdown-after.json
restore-plan.json
restore-after.json
after.json
diff.json / diff.csv / diff.html
Logs\
BizTalkPlatformManagementTool-YYYY-MM-DD.log
```
- `before.json`, `after.json`
- `shutdown-plan.json`, `restore-plan.json`
- `shutdown-after.json`, `restore-after.json`
- `diff.json`, `diff.csv`, `diff.html`
- Snapshot sidecars: `*.csv`, `*.hosts.csv`, `*.html`
- Runtime logs next to the executable: `BizTalkPlatformManagementTool-yyyy-MM-dd.log`
Zu jedem Snapshot entstehen CSV- und HTML-Begleitberichte. Vollständige
Transportadressen werden nicht gespeichert, weil sie Zugangsdaten oder andere
sensible URI-Bestandteile enthalten können und für die Wiederherstellung nicht
benötigt werden.
Log files are retained for the current day plus the previous four days. Older `BizTalkPlatformManagementTool-*.log` files are removed on startup.
## Build und Tests
## Troubleshooting
Voraussetzung ist das .NET Framework 4.6.1 Developer Pack:
The Operation Log shows the WMI class, key property, key value and method for real shutdown and restore steps. WMI objects are resolved with a broad `SELECT * FROM <class>` query and a client-side key filter so names containing special characters do not break the WMI query parser.
```cmd
msbuild BizTalkPlatformManagementTool.sln /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU"
tests\BizTalkPlatformManagementTool.Tests\bin\Release\BizTalkPlatformManagementTool.Tests.exe
```
Snapshot and plan JSON files are written as UTF-8 without BOM. Loading is tolerant of existing files that contain a UTF-8 BOM or a visible BOM marker from previous encoding conversions.
Der Release-Build erzeugt automatisch:
## Build
```text
artifacts\BizTalkPlatformManagementTool-Setup\
artifacts\BizTalkPlatformManagementTool-Setup.zip
artifacts\BizTalkPlatformManagementTool-Setup.zip.b64.txt
artifacts\BizTalkPlatformManagementTool-Setup.zip.sha256.txt
```
Open `BizTalkPlatformManagementTool.sln` in Visual Studio on Windows with the .NET Framework 4.6.1 Developer Pack installed, then build the `Release|Any CPU` configuration.
The app targets .NET Framework 4.6.1 for compatibility with customer environments that do not have newer .NET Framework developer packs installed.
## Documentation
## Dokumentation
- [Installation](Installation.md)
- [Dokumentation](Dokumentation.md)
- [References](REFERENCES.md)
- [Technische Dokumentation](Dokumentation.md)
- [Microsoft-Referenzen](REFERENCES.md)