Browsing Storage Resources with Server Explorer
If you've installed the Windows Azure Tools for Microsoft Visual Studio, you can view blob, queue, and table data from your storage accounts for Windows Azure. By using the Windows Azure Storage node in Server Explorer, you can display data from your local storage emulator account and also from storage accounts that you've created for Windows Azure.
You display Server Explorer in Visual Studio by, on the menu bar, choosing View, Server Explorer. Any Windows Azure storage accounts to which you've connected appear below the Windows Azure Storage node. If your storage account doesn't appear, you can add it by following the instructions at the end of this topic.
Server Explorer is automatically configured to display blobs, queues, and tables in your storage emulator account. To see these resources, expand the (Development) node underneath the Windows Azure Storage node. If the storage emulator has not been started when you expand the (Development) node, it will be started. This can take several seconds. You can continue to work in other areas of Visual Studio while the storage emulator starts.
To view resources in your storage account, expand the node for that account in Storage Explorer. The following nodes will be displayed:
Working with Blob Resources
Beneath the Blobs node, a list of containers for the storage account is displayed. To display a list of the blobs for a container, open a shortcut menu for a container name in the list and then choose View Blob Container. For example, the following illustration shows a list of blobs in a container called mycontainer:
You can perform the following operations on blobs by using the buttons in the top-right corner of the blob container view:
Apply a filter
Refresh the list of blobs in the container
Upload a file
Delete a blob
Download a blob, and edit it on the local machine
When you choose a blob, its properties appear in the Properties window. These properties are updated with the most recent value from the Blob service only if the container is refreshed.
You can filter the blobs that are displayed by specifying a common prefix. For example, if you type the prefix Hello in the filter text box and choose the Execute button, only blobs that begin with Hello are displayed, as shown in the following illustration:
The filter field is case-sensitive and it does not support filtering with wild card characters. Blobs can only be filtered by prefix. The prefix may include a delimiter if you are using a delimiter to organize blobs in a virtual hierarchy. For example, filtering on the prefix HelloFabric/ returns all blobs beginning with that string. See Enumerating Containers and Blobs for more information about how to use prefixes and delimiters to filter a list of blobs.
Downloading blob data
To download blob data to your local computer, open the shortcut menu for one or more blobs and then choose Open, or choose the blob name and then choose the Open button. The progress of a blob download appears in the Windows Azure Activity Log window.
The blob opens in the default editor for that file type. If the operating system recognizes the file type, the file opens in a locally installed application; otherwise, you're prompted to choose an application that’s appropriate for the file type of the blob. The local file that’s created when you download a blob is marked as read-only.
Blob data is cached locally and checked against the blob's last modified time in the Blob service. If the blob has been updated since it was last downloaded, it will be downloaded again; otherwise the blob will be loaded from the local disk.
By default a blob is downloaded to a temporary directory. To download blobs to a specific directory, open the shortcut menu for the selected blob names and choose Save As. When you save a blob in this manner, the blob file is not opened, and the local file is created with read-write attributes.
You can upload files to a blob container by choosing the Upload Blob button when the container is open for viewing. You can choose one or more files to upload, and you can upload files of any type. The Windows Azure Activity Log shows upload progress.
Viewing logs transferred to blobs
If you are using Windows Azure Diagnostics to log data from your Windows Azure application and you have transferred logs to your storage account, you will see containers that were created by Windows Azure for these logs. Server Explorer provides an easy way to view logging data to identify problems with your application, especially when it has been deployed to Windows Azure. For more information about Windows Azure Diagnostics, see Collecting Logging Data by Using Windows Azure Diagnostics.
For more information about how to work with blob data, see How to use the Windows Azure Blob Storage Service in .NET.
Obtaining the URL for a blob
You can copy the URL for a blob by opening its shortcut menu and then choosing Copy URL.
Editing a blob
You can open a blob for editing by choosing it and then choosing the Open Blob button. The file is downloaded to a temporary location and opened on the local machine. You must upload the blob again after you make changes.
Working with Queue Resources
Storage services queues are hosted in a storage account, and you can use them to allow your cloud service roles to communicate with each other and with other services by a message passing mechanism. You can access the queue programmatically through a cloud service and over a web service for external clients. You can also access the queue directly by using Server Explorer in Visual Studio.
When you develop a cloud service that uses queues, you might want to use Visual Studio to create queues and work with them interactively while you develop and test your code.
In Server Explorer, you can view the queues in a storage account, create and delete queues, open a queue to view its messages, and add messages to a queue. When you open a queue for viewing, you can view the individual messages, and you can perform the following actions on the queue by using the buttons in the top-left corner:
Refresh the view of the queue
Add a message to the queue
Dequeue the topmost message.
Clear the entire queue
The following image shows a queue that contains two messages.
For more information about storage services queues, see How to: Use the Queue Storage Service. For information about the web service for storage services queues, see Queue Service Concepts. For information about how to send messages to a storage services queue by using Visual Studio, see Sending Messages to a Storage Services Queue.
Storage services queues are distinct from service bus queues. For more information about service bus queues, see Service Bus Queues, Topics, and Subscriptions.
Working with Table Resources
Expand the Tables node to see a list of tables for the storage account. To display the data in a table, open the shortcut menu for a table and then choose View Table. The table is organized by entities (shown in rows) and properties (shown in columns). For example, the following illustration shows entities listed in the Table Designer:
You can create tables by using Server Explorer. To create a table, open the shortcut menu for the Tables node, and then choose Create Table.
Editing Table Data
You can edit table data by opening the shortcut menu for an entity (a single row) or a property (a single cell) and then choosing Edit or Delete.
Entities in a single table aren’t required to have the same set of properties (columns). Keep in mind the following restrictions on viewing and editing table data.
You can’t view or edit binary data (type byte), but you can store it in a table.
You can’t edit the PartitionKey or RowKey values, because table storage in Windows Azure doesn't support that operation.
You can’t create a property called Timestamp, Windows Azure Storage services use a property with that name.
If you enter a DateTime value, you must follow a format that's appropriate to the region and language settings of your computer (for example, MM/DD/YYYY HH:MM:SS [AM|PM] for U.S. English).
To delete a table permanently, open its shortcut menu, and then choose Delete.
You can also add entities (rows) by choosing the Add Entity button, which is near the top-right corner of the table view.
In the Add Entity dialog box, enter the values of the PartitionKey and RowKey properties. Enter the values carefully because you can't change them after you close the dialog box unless you delete the entity and add it again.
You can customize the set of entities that are shown from a table if you use the query builder. To open the query builder, open a table for viewing, and then choose the rightmost button on the table view’s toolbar. The Query Builder dialog box opens. The following illustration shows a query that's being built in the query builder.
When you’re done building the query, close the dialog box, the resulting text form of the query appears in a text box as a WCF Data Services filter. To run the query, choose the green triangle icon.
You can also filter entity data that appears in the Table Designer if you enter a WCF Data Services filter string directly in the filter field. This kind of string is similar to a SQL WHERE clause but is sent to the server as an HTTP request.
For information about how to construct filter strings, see Constructing Filter Strings for the Table Designer.
The following illustration shows an example of a valid filter string:
Refreshing Storage Data
When Server Explorer connects to or retrieves data from a storage account, it might take up to a minute for the operation to complete. If a connection cannot be made, the operation might time out. While data is retrieved, you can continue to work in other parts of Visual Studio. To cancel the operation if it is taking too long, choose the Stop Refresh button on the Server Explorer toolbar.
To refresh the list of containers for a storage account, select the Blobs node beneath Windows Azure Storage and choose the Refresh button on the Server Explorer toolbar. To refresh the list of blobs that is displayed, choose the Execute button.
To refresh the list of tables for a storage account, select the Tables node and choose the Refresh button. To refresh the list of entities that is displayed in the Table Designer, choose the Execute button on the Table Designer.
To refresh the list of queues for a storage account, choose the Queues node, and then choose the Refresh button.
All Items in Storage Account
To refresh all containers, blobs, queues, tables, and entities in the storage account, choose the account name, and then choose the Refresh button on the toolbar for Server Explorer.
To add a storage account to Server Explorer
In Server Explorer, open the shortcut menu for the Windows Azure Storage node, and then choose Add New Storage Account.
Under Connect using, choose the Your subscription option button.
In the Subscription list, choose your subscription.
If your subscription doesn’t appear in the list, choose the Download Publish Settings link to download a .publishsettings file, and then choose Import to import the .publishsettings file that’s stored on disk.
In the Account name list, choose the name of your storage account.
Windows Azure Tools uses the .publishsettings file to obtain storage account credentials automatically. You can also specify your storage account credentials manually if you choose the Manually entered credentials option button. When you choose this option button, the dialog box changes to resemble the following illustration.
You can get your storage account name and primary key from the Management Portal. To enter storage account settings manually, continue with this procedure. Otherwise, choose the OK button.
To remove a storage account from Server Explorer, open the shortcut menu for the account name, and then choose Delete. If you delete a storage account, any saved key information for that account is also removed.
If you delete a storage account from Server Explorer, it does not affect your storage account or any data that it contains; it simply removes the reference from Server Explorer.