Skip to content
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

Method Not Found Error for Invoke-SqlCmd Cmdlet #97

Open
skpadhy33 opened this issue Sep 25, 2024 · 0 comments
Open

Method Not Found Error for Invoke-SqlCmd Cmdlet #97

skpadhy33 opened this issue Sep 25, 2024 · 0 comments

Comments

@skpadhy33
Copy link

Repro steps:

Open PS5 and run the following snippet to get the error. The issue occurs with the specified version of the SqlServer PS module.

Import-Module SqlServer -RequiredVersion 22.0.59
Import-Module Az.Accounts
$connStr = "<connection_string_to_a_database.>"
$q = "a_simple_query_to_the_db"
Invoke-SqlCmd -ConnectionString $connStr -Query $q -QueryTimeout 60

Expected behaviour: The cmdlet should run without any error.
Actual Behaviour: The Invoke-SqlCmd cmdlet errors out saying the following:
"Method not found: 'Void Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.SqlColumnEncryptionAzureKeyVaultProvider..ctor(Azure.Core.TokenCredential)'."

Stack trace:
at Microsoft.SqlServer.Management.AlwaysEncrypted.Management.SqlAKVProviderWithDisposableCache..ctor(TokenCredential tokenCredential)
at Microsoft.SqlServer.Management.AlwaysEncrypted.Management.AlwaysEncryptedManagement.SetCustomProvidersWithDisposableCache(Boolean useGlobalCredential)
at Microsoft.SqlServer.Management.PowerShell.Shared.AzureKeyVaultUtilities.RegisterCustomKeyStoreProviders(String keyVaultAccessToken, String managedHsmAccessToken, SqlConnection conn)
at Microsoft.SqlServer.Management.PowerShell.GetScriptCommand.ProcessRecord()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant