Banner.jpg .
-
Upload
godwin-hector-ellis -
Category
Documents
-
view
218 -
download
0
Transcript of Banner.jpg .
Using Windows Azure Blob Storage with SharePoint 2010Speaker Name
Outline
Windows Azure Data StorageBlob Data ModelBlob REST interfaceBlob TypesAccess ControlIntegrating Azure Blobs and SharePoint 2010
Windows Azure Data Storage
Windows Azure BlobThe focus of this presentation
Windows Azure TableWindows Azure Queue
Blob Data Model
Account Container Blob
My Account
Images
Videos
Img1.jpg
Img2.jpg
Mov1.avi
Blob REST Interface
Blob storage can be accessed through a RESTful interfaceHTTPS PUT, GET, and DELETE operationsOperations abstracted into an API
http://fabrikamlegal.blob.core.windows.net/imagefiles?resttype=container&comp=list
<?xml version="1.0" encoding="utf-8" ?> <EnumerationResults ContainerName="http://fabrikamlegal.blob.core.windows.net/imagefiles"> <Blobs> <Blob> <Name>Banner.jpg</Name> <Url>http://fabrikamlegal.blob.core.windows.net/imagefiles/Banner.jpg</Url> </Blob> <Blob> <Name>Boy_And_Gift.png</Name> …
Blob REST API – Creating Containers
API is a wrapper around RESTful serviceMakes it easy to call operations
CloudStorageAccount acct = CloudStorageAccount.FromConfigurationSetting( "DataConnectionString");
CloudBlobClient client = acct.CreateCloudBlobClient();CloudBlobContainer con = client.GetContainerReference("videofiles");con.CreateIfNotExist();
Blob REST API – Writing a Blob
FileStream fs = new FileStream("mov1.avi",…,…,…);
var blob = con.GetBlobReference("mov1.avi");blob.UploadFromStream(fs);blob.Metadata["VideoName"] = "Wildlife.avi";blob.Metadata["Category"] = "Travel";blob.Metadata["DateSubmitted"] = DateTime.Now;blob.SetMetadata();blob.Properties.ContentType = "video/x-msvideo";blob.SetProperties();
Blob REST API – Reading Blobsvar azureBlobs = con.ListBlobs();var listOfBlobs = new List<VideoBlobStorage>();foreach (var blobItem in azureBlobs){ var azureBlobRecord = con.GetBlobReference(blobItem.Uri.ToString()); azureBlobRecord.FetchAttributes(); listOfBlobs (new VideoBlobStorage() { FileUri = blobItem.Uri, VideoName = azureBlobRecord.Metadata["VideoName"], Category = azureBlobRecord.Metadata["Category"], DateSubmitted = azureBlobRecord.Metadata["DateSubmitted"] });}
Managing Blob StorageManaging Blob Storage
Demo
Blob Types
Block BlobsBlobs made up of individual “blocks”Optimized for steamingEach block can be 4MB in sizeTotal Blob can be 200 GB in size
Page BlobsBlobs made up of a collection of “pages”Optimized for random read/write operationsPage is a range of data similar to a bufferTotal Blob can be 1 TB in size
Blob Access Control
Public Access ControlAllows unrestricted accessNote that cross-domain calls may still fail
Shared Access SignaturesUses an authentication token valid for a period of timeSignature is appended to URL as query string
Container-Level Access PoliciesAllows the definition of a named access policyPolicy uses Shared Access Signatures
Public Access Control
azureBlobPermissions = new BlobContainerPermissions();azureBlobPermissions.PublicAccess = BlobContainerPublicAccessType.Container;cont.SetPermissions(azureBlobPermissions);
Shared Access Signatures
SharedAccessPolicy policy = new SharedAccessPolicy();policy.Permissions = SharedAccessPermissions.Read;policy.SharedAccessStartTime = DateTime.UtcNow.AddMinutes(-10);policy.SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(60);String signature = blob.GetSharedAccessSignature(policy);
Container-Level Access Policies
SharedAccessPolicy policy = new SharedAccessPolicy();policy.Permissions = SharedAccessPermissions.Read;policy.SharedAccessStartTime = DateTime.UtcNow.AddMinutes(-10);policy.SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(60);String signature = blob.GetSharedAccessSignature(policy);
azureBlobPermissions = new BlobContainerPermissions();azureBlobPermissions.SharedAccessPolicies.Add("policy1“, policy);cont.SetPermissions(azureBlobPermissions);
Azure Storage ExplorerAzure Storage Explorer
Demo
Integrating with SharePoint 2010
IFrameIntegrate web roles that use the REST APISimple, but not robust
Silverlight Media Player directly accessing public blobsWCF Web Role Proxy
RESTful interface to blob storage does not support cross-domain callsCreate a simple WCF Web Role to act as proxyHttpWebRequest, WebClient classes
Custom web partsSilverlight applications
WCF Web Role Proxy
Cross Domain CallsNot allowed unless service has ClientAccessPolicy.xml fileAzure does not support uploading this fileCreate WCF Web Role and include ClientAccessPolicy.xml
[ServiceContract] public interface IService1 { [OperationContract] [WebGet(UriTemplate = "{Container}")] Stream BlobInfo(string Container); }
SharePoint 2010 IntegrationSharePoint 2010 Integration
Demo
Summary
Windows Azure Data StorageBlob Data ModelBlob REST interfaceBlob TypesAccess ControlIntegrating Azure Blobs and SharePoint 2010
Call to ActionFor Download
Download SharePoint VMhttp://www.microsoft.com/downloads/details.aspx?familyid=751FA0D1-356C-4002-9C60-D539896C66CE&displaylang=en
Download Azure Developer Centerhttp://msdn.microsoft.com/en-us/azure/default.aspx
Windows Azure SDK and Windows Azure Tools for Microsoft Visual Studio (November 2010)
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7a1089b6-4050-4307-86c4-9dadaa5ed018&displaylang=en
For ReferenceChannel 9 SharePoint Developer Training Kit
http://channel9.msdn.com/learn/courses/SharePoint2010Developer/
Channel 9 Azure Developer Training Kithttp://channel9.msdn.com/learn/courses/Azure/