microsoft / SQLServerPSModule

This repo is the home of SQL Server PowerShell Module development.
MIT License
51 stars 1 forks source link

Method Not Found Error for Invoke-SqlCmd Cmdlet #97

Open skpadhy33 opened 1 month ago

skpadhy33 commented 1 month ago

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