#r "System.Data"
#r "System.Threading"
#r "Microsoft.WindowsAzure.Storage"
using System.Net;
using System.Data;
using System.Data.SqlClient;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure.Storage.DataMovement;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req,
TraceWriter log)
{
log.Info("C# HTTP trigger function processed a request.");
// parse query parameter
string name = req.GetQueryNameValuePairs()
.FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0)
.Value;
if (name == null)
{
// Get request body
dynamic data = await req.Content.ReadAsAsync<object>();
name = data?.name;
}
return name == null
? req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a name on the query string or in the request body")
: req.CreateResponse(HttpStatusCode.OK, "Hello " + name);
}
I am trying to use an Httptriggered azure function to run DataMovement between cloud blob containers. However I keep getting the following error:
2018-02-06T23:59:58.392 run.csx(12,38): error CS0234: The type or namespace name 'DataMovement' does not exist in the namespace 'Microsoft.WindowsAzure.Storage' (are you missing an assembly reference?) 2018-02-06T23:59:58.407 Exception while executing function: Functions. Microsoft.Azure.WebJobs.Script: Script compilation failed. 2018-02-06T23:59:58.407 Function completed (Failure, Id=72ab129f-706e-497c-ac70-fcebdd3b41ec, Duration=131ms)
Can I use more assemblys than the list provided here: https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-csharp#referencing-external-assemblies
or not? IF so, how?
csx
scripts. Referencing libraries and NuGet packages is much more straightforward there. – Mikhail Shilkov