Skip to content

Commit c26c4aa

Browse files
author
Uwe Janke
committed
v1.8.19.0: CRITICAL FIX - Sync-Job.ps1 was losing logins via -Force in unattended runs
The SQL Agent job called Sync-sqmLoginsToAlwaysOn -Force. -Force causes DROP+CREATE (not ALTER) for already-existing logins on the secondary. If CREATE fails afterwards for any reason (policy, transient error, AD latency), the login is gone entirely instead of just not updated. Uwe confirmed real login loss in unattended Agent runs; manual runs without -Force were fine. Fix: Agent job now calls -Force:$false - only missing logins are added on secondaries, existing ones are left untouched (no more DROP possible). Removed -BackupLogins (only active together with -Force anyway). Deliberate trade-off: password/attribute drift on existing logins is no longer propagated by the automated sync job. Sync-sqmLoginsToAlwaysOn -Force -BackupLogins remains available for deliberate manual updates; the function default for -Force is unchanged ($true) - only the Agent job invocation was changed.
1 parent a910566 commit c26c4aa

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# sqmSQLTool — Changelog
22

3+
## [1.8.19.0] — 2026-07-02
4+
5+
### Bugfix (kritisch)
6+
7+
**jobs/Sync-Job.ps1** — Login-Verlust im unbeaufsichtigten Agent-Lauf durch `-Force`
8+
- Im SQL-Agent-Job rief `Sync-Job.ps1` `Sync-sqmLoginsToAlwaysOn -Force` auf. `-Force`
9+
bewirkt bei bereits vorhandenen Logins DROP + CREATE (nicht ALTER, siehe 1.8.18.0).
10+
Schlaegt CREATE danach fehl (Policy, Transientes, AD-Latenz o.ae.), ist der Login
11+
komplett weg statt nur nicht aktualisiert - im unbeaufsichtigten Agent-Kontext
12+
bestaetigt Uwe konkreten Verlust mehrerer Logins; manuelle Laeufe ohne `-Force`
13+
blieben unauffaellig.
14+
- Fix: Agent-Job ruft jetzt `-Force:$false` auf - es werden nur fehlende Logins auf
15+
den Secondaries ergaenzt, bestehende bleiben unangetastet (kein DROP mehr moeglich).
16+
`-BackupLogins` entfernt (war ohnehin nur mit `-Force` aktiv, siehe
17+
`if ($BackupLogins -and $Force)` in Sync-sqmLoginsToAlwaysOn.ps1).
18+
- Bewusster Trade-off: Passwort-/Attribut-Drift auf bereits vorhandenen Logins wird
19+
ueber den automatischen Sync-Job nicht mehr propagiert. Fuer bewusste, manuelle
20+
Aktualisierung bestehender Logins bleibt `Sync-sqmLoginsToAlwaysOn -Force
21+
-BackupLogins` weiterhin verfuegbar (Funktions-Default fuer `-Force` unveraendert
22+
`$true`, nur der Agent-Job wurde umgestellt).
23+
324
## [1.8.18.0] — 2026-07-02
425

526
### Bugfix

jobs/Sync-Job.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
Import-Module sqmSQLTool -Force
44

5-
Sync-sqmLoginsToAlwaysOn -Force -BackupLogins -BackupRetentionDays 0 -NoReport -Confirm:$false -ErrorAction Stop
5+
Sync-sqmLoginsToAlwaysOn -Force:$false -BackupRetentionDays 0 -NoReport -Confirm:$false -ErrorAction Stop
66

77
exit 0

sqmSQLTool.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
RootModule = 'sqmSQLTool.psm1'
1818

1919
# Version number of this module.
20-
ModuleVersion = '1.8.18.0'
20+
ModuleVersion = '1.8.19.0'
2121

2222
# ID used to uniquely identify this module
2323
GUID = 'c4b10ba2-aee2-4d8d-ad86-a6e97c346ba6'

0 commit comments

Comments
 (0)