diff --git a/doc/31-Changelog.md b/doc/31-Changelog.md index 2cb61ea..2080900 100644 --- a/doc/31-Changelog.md +++ b/doc/31-Changelog.md @@ -11,6 +11,10 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic [Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/10?closed=1) +### Bugfixes + +* [#127](https://github.com/Icinga/icinga-powershell-framework/issues/127) Fixes wrong error message on failed MSSQL connection due to database not reachable by using `-IntegratedSecurity` + ## 1.2.0 (2020-08-28) [Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/7?closed=1) diff --git a/lib/mssql/Open-IcingaMSSQLConnection.psm1 b/lib/mssql/Open-IcingaMSSQLConnection.psm1 index cb7617f..f2d38d6 100644 --- a/lib/mssql/Open-IcingaMSSQLConnection.psm1 +++ b/lib/mssql/Open-IcingaMSSQLConnection.psm1 @@ -89,11 +89,13 @@ function Open-IcingaMSSQLConnection() return $null; } - Exit-IcingaThrowException ` - -InputString $_.Exception.Message ` - -StringPattern $Username ` - -ExceptionType 'Input' ` - -ExceptionThrown $IcingaExceptions.Inputs.MSSQLCredentialHandling; + if ([string]::IsNullOrEmpty($Username) -eq $FALSE) { + Exit-IcingaThrowException ` + -InputString $_.Exception.Message ` + -StringPattern $Username ` + -ExceptionType 'Input' ` + -ExceptionThrown $IcingaExceptions.Inputs.MSSQLCredentialHandling; + } Exit-IcingaThrowException ` -InputString $_.Exception.Message `