Closed ErikEJ closed 7 years ago
I haven't tested with Azure specifically, but that example is clearly using the MongoDB C# driver so I don't see any reason why it wouldn't work. You should be able to copy the connection string.
The driver certainly supports SSL, but I'm uncertain how Azure's DocumentDB facade handles certificates. MongoDbOptionsExtension (and the options builder extension) supports direct configuration of MongoClientSettings, MongoUrl or even your own MongoClient instance on top of pure connection strings. If it can be configured in the driver, then it can be passed to the EF Core provider:
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
MongoClientSettings settings = MongoClientSettings.FromUrl(new MongoUrl($"mongodb://localhost"));
settings.SslSettings = new SslSettings
{
EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12
};
optionsBuilder.UseMongoDb(settings);
//optionsBuilder.UseMongoDb(new MongoClient(settings));
}
I'm working on documenting the API, creating GitHub docs, and beefing up the wiki. I've made a note to include this info and do some basic exploration of MongoDb on Azure.
https://docs.microsoft.com/en-us/azure/documentdb/documentdb-connect-mongodb-account