SQLServerPSModule icon indicating copy to clipboard operation
SQLServerPSModule copied to clipboard

Method Not Found Error for Invoke-SqlCmd Cmdlet

Open skpadhy33 opened this issue 1 year ago • 0 comments

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()

skpadhy33 avatar Sep 25 '24 17:09 skpadhy33