Skip to content

Instantly share code, notes, and snippets.

View ealsur's full-sized avatar

Matias Quaranta ealsur

View GitHub Profile
@ealsur
ealsur / run.csx
Created February 6, 2018 00:29
Azure Cosmos DB + Functions Cookbook - live migration run.csx
#r "Microsoft.Azure.Documents.Client"
using System;
using System.Collections.Generic;
using Microsoft.Azure.Documents;
public static async Task Run(IReadOnlyList<Document> input, IAsyncCollector<Document> docsToSave)
{
foreach(var doc in input){
// work with the document, process or create a new one
await docsToSave.AddAsync(doc);
@ealsur
ealsur / function.json
Last active February 7, 2018 19:42
Azure Cosmos DB + Functions Cookbook - live migration function.json
{
"bindings": [
{
"type": "cosmosDBTrigger",
"name": "input",
"direction": "in",
"databaseName": "<name-of-your-monitored-database>",
"collectionName": "<name-of-your-monitored-collection>",
"connectionStringSetting": "<name-of-connection-string-setting>",
"leaseCollectionName": "leases",
@ealsur
ealsur / function.json
Created February 16, 2018 19:25
Azure Cosmos DB + Functions Cookbook - search indexing function.json
{
"bindings": [
{
"type": "cosmosDBTrigger",
"name": "input",
"direction": "in",
"databaseName": "<name-of-your-monitored-database>",
"collectionName": "<name-of-your-monitored-collection>",
"connectionStringSetting": "<name-of-connection-string-setting>",
"leaseCollectionName": "leases",
@ealsur
ealsur / run.csx
Last active February 16, 2018 19:58
Azure Cosmos DB + Functions Cookbook - search indexing run.csx
#r "Microsoft.Azure.Documents.Client"
using System;
using System.Configuration;
using System.Collections.Generic;
using Microsoft.Azure.Documents;
using Microsoft.Azure.Search;
private static string searchServiceName = ConfigurationManager.AppSettings["SearchServiceName"];
private static string searchServiceKey = ConfigurationManager.AppSettings["SearchServiceKey"];
private static SearchServiceClient serviceClient = new SearchServiceClient(searchServiceName, new SearchCredentials(searchServiceKey));
@ealsur
ealsur / project.json
Created February 16, 2018 19:26
Azure Cosmos DB + Functions Cookbook - search indexing project.json
{
"frameworks": {
"net46":{
"dependencies": {
"Microsoft.Azure.Search": "3.0.5"
}
}
}
}
@ealsur
ealsur / sample.json
Created February 16, 2018 19:51
Azure Cosmos DB + Functions Cookbook - search indexing sample.json
{
"name": "john",
"born": "1983-05-07",
"id": "f08cfd6b-303e-654b-9c49-41a47ebbeae7"
}
@ealsur
ealsur / dataaicosmos2018.md
Last active March 19, 2018 13:04
Data & AI 2017 - Cosmos DB
@ealsur
ealsur / run.csx
Created March 9, 2018 07:36
Azure Cosmos DB + Functions Cookbook —secure access run.csx
#r "Microsoft.Azure.Documents.Client"
using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Client;
using System.Net;
using System.Configuration;
using Microsoft.Azure.KeyVault;
using Microsoft.Azure.Services.AppAuthentication;
private static HttpClient httpClient = new HttpClient();
private static DocumentClient client = null;
@ealsur
ealsur / function.json
Created March 9, 2018 07:38
Azure Cosmos DB + Functions Cookbook —secure access function.json
{
"bindings": [
{
"name": "req",
"type": "httpTrigger",
"direction": "in"
},
{
"name": "$return",
"type": "http",
@ealsur
ealsur / project.json
Created March 9, 2018 07:38
Azure Cosmos DB + Functions Cookbook —secure access project.json
{
"frameworks": {
"net46":{
"dependencies": {
"Microsoft.Azure.KeyVault": "2.3.2",
"Microsoft.Azure.Services.AppAuthentication": "1.1.0-preview"
}
}
}
}