Azure Key Vault .NET - Method not found - c#

I want to use an Always Encrypted SQL 2016 DB in my .NET app with an Azure Key Vault for storing the encryption keys. I have been following this article so far:
https://blogs.msdn.microsoft.com/sqlsecurity/2015/11/10/using-the-azure-key-vault-key-store-provider-for-always-encrypted/
But I receive an exception when I reach this line of the code provided in the article:
SqlColumnEncryptionAzureKeyVaultProvider azureKeyVaultProvider =
new SqlColumnEncryptionAzureKeyVaultProvider(GetToken);
The exception is:
Additional information: Method not found: 'Void Microsoft.Azure.KeyVault.KeyVaultClient..ctor(AuthenticationCallback)'.
I've checked my references and everythings seems to be in place. The GetToken authentication callback method is also there.
Can anyone help? Thanks.

It seems like the issue with the latest Microsoft.Azure.KeyVault nuget package. Microsoft.SqlServer.Management.AlwaysEncrypted.AzureKeyVaultProvider package has a dependency on Microsoft.Azure.KeyVault v 1.0.0 and if you install the latest version (v 2.0.6) it brakes SqlColumnEncryptionAzureKeyVaultProvider. Downgrade Microsoft.Azure.KeyVault package to v 1.0.0 and you will be fine...

This is a known issue of aspnet/Configuration. See https://github.com/aspnet/Configuration/issues/569

Please use version 2.0.20170208 or greater of the nuget package, this should resolve your problem.

Related

Microsoft SqlServer Management: method not found creating a ServerConnection

Microsoft.SqlServer.SqlManagementObjects 161.47027.0
Microsoft.Data.SqlClient 5.0.0
After upgrading Microsoft.Data.SqlClient from 4.1.0 to 5.0.0
I got this error creating a ServerConnection object:
using Microsoft.SqlServer.Management.Common;
var serverConnection = new ServerConnection("localhost", "sa", "mypwd");
System.MissingMethodException: 'Method not found: 'Void
Microsoft.Data.SqlClient.SqlConnectionStringBuilder.set_Encrypt(Boolean)
It looks for a not implemented set_Encrypt method inside a Microsoft.Data.SqlClient.SqlConnectionStringBuilder
Does it mean Microsoft.SqlServer.SqlManagementObjects has not been updated yet to support Microsoft.Data.SqlClient 5.0.0?
If so do I need to wait for this update before I can upgrade Microsoft.Data.SqlClient 5.0.0 into my project?
You can also upgrade the ServerManagementObjects reference to 170.7.0-preview to resolve. Apparently the issue is with the smo library not the sqlclient library.
https://github.com/dotnet/SqlClient/issues/1702
Their code should be backwards compatible, but they need to be recompiled against MDS 5.0
Below is MyConnectionString"
"Server=tcp:xxx.xxxx.windows.net;Authentication=Active Directory Default;Database=TestDB;TrustServerCertificate=True;MultipleActiveResultSets=True;"
Had the error:
Method not found: 'Void Microsoft.Data.SqlClient.SqlConnectionStringBuilder.set_Encrypt(Boolean)'. When usingMicrosoft.Data.SqlClient 5.0.1.`
Fixed By: Downgraded the package Microsoft.Data.SqlClient to 4.1.0.and Using Microsoft.SqlServer.SqlManagementObjects 161.47021.0.
Fixed the error. Thank you for this post.
We had the same MissingMethodException when attempting the update of Microsoft.Data.SqlClient 4.1.0 to 5.0.0 in our system. Simply updating Microsoft.Data.SqlClient - independently of Microsoft.SqlServer.SqlManagementObjects - resulted in the exception when constructing the Microsoft.SqlServer.Management.Common.ServerConnection using SQL Server Authentication (not Windows Authentication).
This snippet causes the MissingMethodException if using Microsoft.Data.SqlClient 5.0.0 (worked in 4.1.0):
Return New ServerConnection With {
.ApplicationName = My.Application.Info.Title,
.ServerInstance = connectionParameters.DataSource,
.ConnectTimeout = connectionParameters.ConnectionTimeout,
.LoginSecure = False,
.Login = connectionParameters.UserName,
.Password = connectionParameters.Password
}
For now, we are holding off on updating Microsoft.Data.SqlClient, but went ahead with the Microsoft.SqlServer.SqlManagementObjects update (161.47021.0 to 161.47027.0). I am hopeful that an upcoming Microsoft.Data.SqlClient version will fix this issue.

Which Namespace or Nuget Binding BlobProperties in Azure Functions V3

Is there a Nuget/Assembly/Library that will allow me to bind BlobProperties for .NET Core Azure 3.x Functions, in both a local environment and in an Azure environment?
I have an Azure Function running on .NET Core 3 with a signature that looks like this:
public async Task DoFunctionWork([BlobTrigger("path/to/{blobName}")] Stream blobStream,
**Microsoft.Azure.Storage.Blob.BlobProperties Properties**)
{
//Function Body....
}
The problem is with the Properties parameter. If run locally, it can only be resolved if I prefix the BlobProperties parameter with the Microsoft.Azure.Storage.Blob namespace as above. In Azure, it never seems to work. When it fails - on either Azure or locally - I get one of the following messages:
Can't bind properties to type 'Azure.Storage.Blob.Properties' or Can't bind properties to type 'Microsoft.Azure.Storage.Blob.Properties'
Has anyone encountered this before? How did you solve it?
Thanks.
It looks like this is because, there is a version mismatch between what your SDK requires and what you have installed.
For instance, if you are using 3.0.9 version of Function SDK, then you might have installed Microsoft.Azure.WebJobs other than (>= 3.0.0 && < 3.1.0) versions.
Microsoft.NET.Sdk.Functions 3.0.9
Microsoft.Azure.WebJobs.Extensions.Storage 4.0.3

Rebus - System.MissingMethodException : Method not found: 'System.Threading.Tasks.Task Rebus.Bus.IBus.Send'

When calling SendRequest using Rebus.Async, I get this error:
System.MissingMethodException : Method not found: 'System.Threading.Tasks.Task Rebus.Bus.IBus.Send(System.Object, System.Collections.Generic.Dictionary`2)'.
How can I resolve this?
Check your NuGet package versions. Make sure one isn't a prerelease version while the others are stable.
For me, I had installed a Rebus extension that depended on the prerelease version of another Rebus package. Updating all Rebus packages to the latest (prerelease where applicable; latest stable otherwise) versions fixed the issue.

Xamarin.Firebase.Common not compatible with Xamarin.Firebase.Auth

I'm trying to install 'Xamarin.Firebase.Storage.42.1021.1' so I can upload photos to my firebase database
I'm targeting 'MonoAndroid, Version=v7.1'
However, when I try to install the package I get the following
Unable to find a version of 'Xamarin.Firebase.Common' that is compatible with 'Xamarin.Firebase.Auth 42.1024.0-beta1 constraint: Xamarin.Firebase.Common (= 42.1024.0-beta1)', 'Xamarin.Firebase.Storage 42.1021.1 constraint: Xamarin.Firebase.Common (= 42.1021.1)'.
Is there a quick fix without breaking my project?
You may checked the Dependencies of Xamarin.Firebase.Storage and Xamarin.Firebase.Auth.
According to your error message, you've installed the Xamarin.Firebase.Auth 42.1024.0-beta1 package, which needs dependency Xamarin.Firebase.Common (= 42.1024.0-beta1).
Try to downgrade your Xamarin.Firebase.Auth package to version 42.1021.1.

AggregateException when calling GetApplicationDefaultAsync()

I am trying to run the sample Vision API project. I basically copied and pasted the code Program.cs into my application and executed it.
This line (which is line #36-#37 in Program.cs)
GoogleCredential credential = GoogleCredential.GetApplicationDefaultAsync().Result;
throws a System.AggregateException in mscorlib.dll with Additional information: One or more errors occurred..
By examining InnerException, I found out that the actual exception thrown is InvalidOperationException with Error deserializing JSON credential data..
Nonetheless, my cloud project is a basic project, with a Service Account, and Cloud Vision API enabled, nothing else. I checked that my environment variable was set to the JSON file by writing:
Console.WriteLine(Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS"));
before the line above. The output of that (just before the crash) is (something like):
C:\Users\me\Documents\Projects\MyProject\MyProject-ba31aae6efa1.json
I checked the file, and it is the file that I got when I enabled my service account. Every property in it looks fine (i.e. project name is correct, path's correct, ...).
I installed the Google Cloud SDK and executed gcloud beta auth application-default login and authorized access to my cloud account.
Any ideas on what might be causing this?
By examining the detailed build log, I found out that the packages for the Google APIs had a dependency for Newtonsoft.Json version 9.0.1 (the latest at the time of this writing).
For whatever reason, the Google APIs packages have a dependency (which is installed along with them) on Newtonsoft.Json version 7.0.0.
The packages came with the wrong version!
Installing the latest version (9.0.1 in this case) fixes the issue.

Categories

Resources