-
-
Notifications
You must be signed in to change notification settings - Fork 832
Connect-DbaInstance / Invoke-DbaQuery - Open a correct new connection when ConnectAsUserName is used and fix usage of AppendConnectionString #9680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
Tests show that there are new problems with changing database context. I will try to look at that tomorrow. |
Ok, @niphlod - now you can have a look. I basically moved your code to Connect-DbaInstance to generally support this case and just changed Invoke-DbaQuery a bit so that AppendConnectionString is forcing a new connection. |
Ups, just forgot the case when AppendConnectionString is used with a simple open connection. Will add this soon... |
sorry @andreasjordan , I'm a bit lost in here. Can I use this PR in lieu of #9667 to see if everything works ? |
Yes. We can just merge this PR here to solve the issue. It's mostly your code - just a bit rearranged. |
ok, lemme try a few combinations then, I'll close mine and approve this as soon as it works as expected. |
@andreasjordan , approved! |
Just added Purpose and Approach to the initial post. @potatoqualitee if you need anything else before merging, please let me know. |
@niphlod - please have a look at the changes. If you like them you can include them in your PR or we can use this PR.
Type of Change
Invoke-ManualPester
)Purpose
This PR addresses two topics:
Approach
While processing a Server SMO inside of Connect-DbaInstance, we identify the usage of windows credentials in case we need to change the connection context because of the given parameters. We then force a completly new connection instead of changing the current connection.
We also identify the usage of windows credentials inside of Invoke-DbaQuery while we test if we can reuse an existing connection or if we have to use Connect-DbaInstance to create a new connection or modify the existing connection.
Commands to test
Screenshots
Learning