-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Invoke-sqlcmd crash on parallel execution #21507
Comments
Might be related to microsoft/SQLServerPSModule/issues/69 |
If you absolutely must do it in parallel and there is no other work around, can you use an SqlConnection directly?
|
Thanks for the report! It's up to the command itself to ensure it doesn't access any static resources in a thread unsafe manner, so marking this as |
This issue has been marked as external and has not had any activity for 1 day. It has been be closed for housekeeping purposes. |
📣 Hey @Ilchert, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗 https://aka.ms/PSRepoFeedback |
Steps to reproduce
I am trying to run parallel queries using
Foreach-Object -Parallel
and invoke-sqlcmd but get errorSequential invoke works fine. I am not sure, that this issue is related to powershell core itself.
Or
Script example
Expected behavior
Invoke should works fine
Actual behavior
Fails with
InvalidOperation: An item with the same key has already been added. Key: AZURE_KEY_VAULT
orThe cmdlet needs to access a key in a key vault or a managed HSM, but you have not provided a valid authentication token, or you don’t have the required permissions. Use -KeyVaultAccessToken and/or -ManagedHSMAccessToken parameters to provide a valid token or authenticate to Azure using the Add-SqlAzureAuthenticationContext cmdlet.
Error details
Environment data
Visuals
The text was updated successfully, but these errors were encountered: