public async Task <CloudBlockBlob> UploadImage(HttpPostedFileBase imageFile) { string blobName = imageFile.FileName;// Guid.NewGuid().ToString() + Path.GetExtension(profileFile.FileName); if (!string.IsNullOrEmpty(blobName)) { // GET a blob reference. CloudBlockBlob imageBlob = ImageContainer.GetBlockBlobReference(blobName); // Uploading a local file and Create the blob. using (var fs = imageFile.InputStream) { await imageBlob.UploadFromStreamAsync(fs); } return(imageBlob); } return(null); }