118
CHAPTER 4 | Azure Storage
Figure 4-5 Select the Azure account with which to log into the Cloud Explorer.
4.
If you don’t have any Azure accounts displayed in the list, click the drop-down list and
select Add
An Account. If you do have accounts displayed, select the one you want to use and log into it.
Click Apply. After logging in, you see something like Figure 4-6.
Figure 4-6 Visual Studio Cloud Explorer, showing resources.
5.
Open the storage account you created with the portal. In the example, that’s azurebooktest. The
storage account
has Blob Containers, Queues, and Tables. Right-click Blob Containers and select
Create Blob Container, as displayed in Figure 4-7.
119
CHAPTER 4 | Azure Storage
Figure 4-7 Create blob container.
6.
It shows a text box; type in the container name. The example uses test-vs. Press Enter; now it
shows your new container under Blob Containers. Double-click the container name to open a
screen where you can upload blobs (Figure 4-8).
Figure 4-8 Ready to upload blobs into the container.
7.
To upload
blobs into the container, click the icon on the top row next to the filter that shows an
up arrow with a line over it (this is the same icon used in Figure 4-14). The Upload New File dialog
opens (Figure 4-9). Browse to find a file. You can set a folder name here.
Note that this is the
pseudo-foldering discussed earlier—it includes the folder name in the blob name with a forward
slash. If you leave the folder blank, it will put the file in the root of the container.
Figure 4-9 Dialog for uploading blobs into the container.
120
CHAPTER 4 | Azure Storage
8.
Upload some files into the root and some files into a folder. You should see something similar to
Figure 4-10. This figure shows a folder called images and two blobs in the root.
Note that it shows
the URL to the blobs. If you open the images folder, it will show the blobs there, and all of the
URLs will have /images/ in them.
Figure 4-10 Screen showing blobs uploaded into the container.
9.
You can delete blobs from the container by using the red X icon, and you can
download blobs
and view them in the picture viewer by double-clicking the entry in the table or by clicking the
forward arrow icon.
One thing this tool does not allow you to do is set the Access Type of the container. By default, the
Cloud Explorer sets it to Private. The Access Type defines who can access the blobs and the container.
If this is Private, the container and the blobs in the container can only be accessed by someone who
has the account credentials (account name and key) or a URL that includes an SAS. If
you set this to
Blob, then anyone with a URL can view the associated blob but cannot view the container properties
and metadata or the list of blobs in the container. If you set this to Container, then everyone has read
access to the container and the blobs therein.
You can change this in the Azure portal and through some storage explorers. In the Azure portal, go
to the storage account,
click Blobs, and then select the container. A blade will open on the right
showing the blobs in the container. Click Access Policy to set it to Blob or Public.
The Cloud Explorer is a pretty simple implementation of accessing blob storage. It does not allow you
to upload or download folders full of images. For more sophisticated applications, check out the list of
storage explorers provided earlier in this section.
Do'stlaringiz bilan baham: