In both dashboard as well as scripts:
- Script using dbatools
- PSCredential object called ‘webatch’ saved as a secret
- Service account called ‘uauto’ running the Universal Automation service
- Connect to database with -sqlcredentials $webatch
- Get back a message that i failed to connect at ‘uauto’
- Both accounts are local admin on the PSU server (not IIS hosted)
- works in ISE/Powershell
Script being run:
import-module dbatools
Get-Variable Webatch
write-output “Attempting to use $($webatch.username)”
$sqlconnection = Connect-DbaInstance -SqlInstance $SQLInstance -Database $Database -sqlcredential $webatch
Output from Log:
[2:54:38 PM] [INF] webatch System.Management.Automation.PSCredential
[2:54:38 PM] [INF] Attempting to use ‘domain\webatch’
[2:54:40 PM] [ERR] Login failed for user ‘domain\UAuto’.