Examine the properties of the client that will interact with Blob storage on Azure.
- [Instructor] With our storage account created, our next step is to create a blob service client. And if we scroll down, you'll see on Line 66 that we use the storage count we call Create Cloud Blob Client, a little hard to say. And what we get back is a cloud blob client, which we'll name Blob Client. We next need a reference to a container, because you remember that accounts contain any number of containers and it's the containers that contain the blob.
In the same file, we can scroll down to Line 79 where we say that we create our container by calling Create Sample Container A Sync, passing in the Blob Client that we created and awaiting on that because it's an asynchronous method. With our container in hand we are ready to start walking through some of the blob client samples. We see them here in this call to the blob client samples so let's step into that.
And here we have some of the samples that we'll be working our way through in order to see how working with blobs works. The first thing that we do is we create a buffer for the blob service client. Note that the blob manager enables reuse of the existing buffer and that all of these sizes must be multiples of 256. Let's look at the first of the samples, Print Service Client Properties for the blob client.
And here we see that this is a private, static method. Returning void by taking the blob client that we created. It's going to display properties of the blob service such as the storage account name, space URI and so forth. Let's run the application and see this output. In order to stop the application when this output is displayed, we'll put a break point because the sample runs undisturbed otherwise, printing out a great deal of information.
And we're going to see a lot of that as we go. But for now, we just want to see this part. So we'll click start, it's going to talk to our account on Azure and notice we've hit our break point, so let's go back to that output window. And here is the list of what it's going to do and down here are the client properties. And notice now they're filled in. The storage account name is exactly what we created on Azure, that's JL Blog Storage.
Your authentication scheme is a shared key, that's the key that we used. It gives us the base URI which we saw when we created the name, that it is appended with dot blob, dot core, dot windows, dot net. We have the primary and secondary URIs and we're going to discuss what those are for. The default buffer size, which is the result of all that multiplication and the default delimiter. So our blob is already being put to use. Let's stop, get rid of that break point, and we are ready to go on to the next sample, which you see is Configure Blob Analytics.
We can look at that but it doesn't display anything. It comes in here, gets the service properties from the blob client, sets the logging operations and how long they should be retained for each kind of log, but nothing is displayed. So let's go back, and the following sample, Get Service Stats for secondary A sync gets the G R replication statistics for our storage, and we'll look at that next.
- Creating an MVC web app
- Publishing an MVC app to Azure
- Creating a SQL database on Azure
- Enabling migrations
- Updating an Azure database
- Changing the schema
- Exploring various types of Blob storage
- Creating Blob storage accounts in Azure
- Examining Azure statistics for monitoring Blob storage