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.
Viewing Storage Resources in Visual Studio
|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 computer
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 computer. 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.
Adding a Storage Account to 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 Attach External Storage.
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 enter storage account settings manually
In the Account name text box, enter the name of your storage account, or copy the name from the Management Portal and then paste the name in the text box by choosing the Ctrl+V keys.
In the Management Portal, choose the Storage button. In the list of storage accounts that appears, choose an account to open a page for it, and then copy the name of the storage account from this page.
In the Account key text box, enter your primary key, or copy it from the Management Portal, and then paste the key in the text box.
To copy this key from the Management Portal, choose the Manage Keys button at the bottom of the page for the appropriate storage account. In the Manage Keys Access page, highlight the text of the primary access key, and then choose the Ctrl-C keys.
When you enter the information about the key for the storage account in Windows Azure, this information is stored locally in the service configuration file. However, this information isn’t encrypted.
Choose one of the following option buttons to determine how the service will access the storage account:
Use HTTP. This option is the standard. For example, the URL might be
Use HTTPS. This option ensures a secure connection. For example, the URL might be
Specify custom endpoints. You can use this option to specify custom endpoints for each of the three services. You can then type these endpoints into the field for the specific service.
Note You can create a more complex connection string by creating custom endpoints. When you use this string format, you can specify storage service endpoints that include a custom domain name that you’ve registered for your storage account with the Blob service. Also you can grant access only to blob resources in a single container through a shared access signature. For more information about how to create custom endpoints, see How to Configure Connection Strings.
- Use HTTP. This option is the standard. For example, the URL might be
To save the account key so that you can use it when you restart Visual Studio, select the Remember Account Key check box so that Visual Studio will encrypt and store your account key locally. If you don’t save the account key, you’ll be prompted for it when you restart Visual Studio if you expand the node for your storage account in Server Explorer.
When you finish specifying your storage account information, 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.
Note 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.