![]() This pauses execution so the console output can be viewed: WriteAzureDirectoriesToConsole(client.ListContainers()) Var client = storageAccount.CreateCloudBlobClient() + DefaultEndpointsProtocol=https AccountName=" ĬloudStorageAccount.Parse(string.Format(AZURE_CONNECTION_STRING, ACCOUNT_NAME, To do this, we use the ListContainers() method of the CloudBlobClient class: // in a real project, one might want to implement some security here:Ĭonst string ACCOUNT_KEY = "myAccountKey" Ĭonst string AZURE_CONNECTION_STRING = "" NET API, we can create a simple Console application which presents required credentials to the Azure storage account, and then retrieves an IEnumerable representing the blob storage containers as follows (note that the various other SDKs and APIs define similar functionality for the appropriate platform/language). API Access to the Storage Account and Containersįirst we will look at some of the basics involved in accessing an Azure storage account and the containers hosted therein. NET API, however, similar implementations are available for Java, Ruby, Python, and other common platforms. While Azure storage itself does not recognize the notion of a directory as implied by the delimited blob name, the Azure SDK for your chosen language does, to a certain extent, and assists us in parsing an implied directory structure out of the blob address + name. If we scroll to the right in the Azure browser view above, we see that the same structure is mirrored in the URL for each file, except the file name now conforms to legal URL naming standards: Similarly, We can also see that there is an implied subdirectory within the Johns Files/ directory named Music/, again containing three files. In the above, for example, the blobs File 1.txt, File 2.txt, and File 3.txt can be thought of a being at the root level of the Storage Container, while the blobs named Johns Files/File 1.txt, Johns Files/File 2.txt, and Johns Files/File 3.txt can be thought of as being contained in a directory named Johns Files/. However, much like your operating system, the various SDK implementations afford functionality which can optionally parse these names into a directory structure. As far as Azure is concerned, these are simply the blob names. In the image above, note the names of the blobs in the ‘Name” column. In the Azure storage Account view, a virtual hierarchal directory structure might look like this: The Blob name above implies that within the container mystorageaccount, there is a directory named Documents, containing a subdirectory named Photos, in which a file named Graduation Pic.jpg is located. ![]() For example, one could create a blob named Documents/Photos/Graduation Pic.jpg, which, assuming the following details, would be addressed as follows:īlob Name: Documents/Photos/Graduation Pic.jpg However, as you recall from our overview, blob names can contain any characters, including forward slashes. In the above, the URL is composed of your Azure Storage Account name, the // namespace, followed by the name of the container in which the blob is located, and finally the name of the blob itself. We address blobs via URLs according to the following format: The blob storage model and associated APIs establish addressing and naming conventions which serve to identify individual blobs within storage containers. It is in this way that we are able to store any type of data on the Blob storage platform, and similarly why blob storage is easily consumed by multiple languages and useable from any platform – the structure of the data is platform agnostic. Organization and interpretation of the data structure is left up to the client. Within the Windows Azure storage model, there is no OS to impose such structure. In the case of your local hard drive, this model is implemented by the operating system. ![]() Much like data on your local hard drive, the notion of directories, files, and the tree-like hierarchal model so familiar to most users is imposed upon the stored data as an abstraction. So far as Azure itself is concerned, a blob represents one or blocks of binary data. Blobs are Great and All That, but What About Files and Folders? If you are not familiar with Azure blob storage, visit the Azure site, or check out an overview of what it’s all about. While many of the recent public announcements have been focused Azure Websites, Deployment from Source Control, and the new general availability of Azure Virtual Machines, one of the core features of the Azure platform remains storage. Windows Azure has matured nicely over the past few years into a very developer-friendly “Infrastructure-As-A-Service” platform. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |