diff --git a/ImageFunctions.sln b/ImageFunctions.sln
index ae1bdba..31c3e29 100644
--- a/ImageFunctions.sln
+++ b/ImageFunctions.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.28010.2036
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageFunctions", "ImageFunctions\ImageFunctions.csproj", "{B6440771-70B9-4353-92B5-216B49EE9E72}"
EndProject
diff --git a/ImageFunctions/ImageFunctions.csproj b/ImageFunctions/ImageFunctions.csproj
index 5bfcb2e..8b8708f 100644
--- a/ImageFunctions/ImageFunctions.csproj
+++ b/ImageFunctions/ImageFunctions.csproj
@@ -4,10 +4,12 @@
v2
-
-
-
-
+
+
+
+
+
+
diff --git a/ImageFunctions/Thumbnail.cs b/ImageFunctions/Thumbnail.cs
index 7a0574d..1623143 100644
--- a/ImageFunctions/Thumbnail.cs
+++ b/ImageFunctions/Thumbnail.cs
@@ -7,12 +7,11 @@
// Use for local testing:
// https://{ID}.ngrok.io/runtime/webhooks/EventGrid?functionName=Thumbnail
+using Azure.Storage.Blobs;
using Microsoft.Azure.EventGrid.Models;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.EventGrid;
using Microsoft.Extensions.Logging;
-using Microsoft.WindowsAzure.Storage;
-using Microsoft.WindowsAzure.Storage.Blob;
using Newtonsoft.Json.Linq;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats;
@@ -28,15 +27,15 @@
namespace ImageFunctions
{
- public static class Thunbnail
+ public static class Thumbnail
{
private static readonly string BLOB_STORAGE_CONNECTION_STRING = Environment.GetEnvironmentVariable("AzureWebJobsStorage");
private static string GetBlobNameFromUrl(string bloblUrl)
{
var uri = new Uri(bloblUrl);
- var cloudBlob = new CloudBlob(uri);
- return cloudBlob.Name;
+ var blobClient = new BlobClient(uri);
+ return blobClient.Name;
}
private static IImageEncoder GetEncoder(string extension)
@@ -89,11 +88,9 @@ public static async Task Run(
{
var thumbnailWidth = Convert.ToInt32(Environment.GetEnvironmentVariable("THUMBNAIL_WIDTH"));
var thumbContainerName = Environment.GetEnvironmentVariable("THUMBNAIL_CONTAINER_NAME");
- var storageAccount = CloudStorageAccount.Parse(BLOB_STORAGE_CONNECTION_STRING);
- var blobClient = storageAccount.CreateCloudBlobClient();
- var container = blobClient.GetContainerReference(thumbContainerName);
+ var blobServiceClient = new BlobServiceClient(BLOB_STORAGE_CONNECTION_STRING);
+ var blobContainerClient = blobServiceClient.GetBlobContainerClient(thumbContainerName);
var blobName = GetBlobNameFromUrl(createdEvent.Url);
- var blockBlob = container.GetBlockBlobReference(blobName);
using (var output = new MemoryStream())
using (Image image = Image.Load(input))
@@ -104,7 +101,7 @@ public static async Task Run(
image.Mutate(x => x.Resize(thumbnailWidth, height));
image.Save(output, encoder);
output.Position = 0;
- await blockBlob.UploadFromStreamAsync(output);
+ await blobContainerClient.UploadBlobAsync(blobName, output);
}
}
else