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()
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 = ""
$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()