-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
I'm having trouble trying to use GMSACredential to connect to a SQL Server with sqlcmd. Here's my current set up:
- I'm opening powershell with my normal AD account, which has permissions on the SQL server.
- I'm successfully getting the credential using Get-GMSACredential.
- I'm using Invoke-GMSACommand to execute a SELECT SUSER_NAME() query on the SQL server.
Expected result: the query will show the gMSA as the account connected to the SQL Server.
Actual result: the query shows my account as account connected to the SQL Server.
Here's my code:
$Cred = Get-GMSACredential -GMSAName 'TheGMSA' -Domain 'TheDomain'
Invoke-GMSACommand -Credential $Cred -ScriptBlock { sqlcmd -E -S TheSQLServer -Q "SELECT SUSER_NAME()" -Y 20 }
Am I misunderstanding the expected usage and the credentials to be passed? Is there a better way to use GMSACredential to run a query on a SQL Server (that we don't control)?
Thanks.
Metadata
Metadata
Assignees
Labels
No labels