[SOLVED] html SAS SQL database network Go Design and Developing Application in Cloud (CT071-3-5-3-DDAC) Azure Blob Storage and Visual Studio Connected Services

$25

File Name: html_SAS_SQL_database_network_Go_Design_and_Developing_Application_in_Cloud_(CT071-3-5-3-DDAC)_Azure_Blob_Storage_and_Visual_Studio_Connected_Services.zip
File Size: 1413 KB

5/5 - (1 vote)

Design and Developing Application in Cloud (CT071-3-5-3-DDAC) Azure Blob Storage and Visual Studio Connected Services
Lab 7: Get started with Azure Blob storage and Visual Studio connected services (ASP.NET Core)
Azure Blob storage is a service that stores unstructured data in the cloud as objects or blobs. Blob storage can store any type of text or binary data, such as a document, media file, or application installer. Blob storage is also referred to as object storage.
This tutorial shows how to write ASP.NET Core code for some common scenarios that use Blob storage. Scenarios include creating a blob container, and uploading, listing, downloading, and deleting blobs.
a.
1. 2.
Create an ASP.NET application project
Estimation time for this section A: 5 Minutes
Open Visual Studio. From the main menu, select File > New > Project.
3.
In the New Project dialog box, select Web > ASP.NET Core Web
Application > AspNetCoreStorage. Then select OK.
In the New ASP.NET Core Web Application dialog box, select .NET
Core > ASP.NET Core 2.0 > Web Application (Model-View-Controller). Then
select OK.
Level 3
Asia Pacific University of Technology & Innovation
Page 1 of 22

Design and Developing Application in Cloud (CT071-3-5-3-DDAC) Azure Blob Storage and Visual Studio Connected Services
b.
1. 2.
Use connected services to connect to an Azure storage account.
Estimation time for this section B: 10 Minutes In Solution Explorer, right-click the project.
From the context menu, select Add > Connected Service.
In the Connected Services dialog box, select Cloud Storage with Azure Storage, and then select Configure.
3.
Level 3
Asia Pacific University of Technology & Innovation Page 2 of 22

Design and Developing Application in Cloud (CT071-3-5-3-DDAC) Azure Blob Storage and Visual Studio Connected Services
4. In the Azure Storage dialog box, select the Azure storage account to be used for this tutorial. To create a new Azure storage account, select Create a New Storage Account, and complete the form.
Level 3 Asia Pacific University of Technology & Innovation Page 3 of 22

Design and Developing Application in Cloud (CT071-3-5-3-DDAC) Azure Blob Storage and Visual Studio Connected Services
5.
After selecting either an existing storage account or creating a new one, select Add. Visual Studio installs the NuGet package for Azure Storage, and a storage connection string to appsettings.json.
To allow the network able to access to manage the blob storage account, a connection string need to generate from the azure portal and replace the current connection string in the appsettings.json. The steps as below:
Go to the storage account and click the Shared access signature button.
Level 3
Asia Pacific University of Technology & Innovation Page 4 of 22
6.

Design and Developing Application in Cloud (CT071-3-5-3-DDAC) Azure Blob Storage and Visual Studio Connected Services
Then, go to the website: https://www.whatismyip.com/ to search your public ipv4 address and attach to the Allowed IP Addresses column. Then, check the HTTPS and HTTP option from the form and choose the key1 in the signing key column.
Then, click on the Generate SAS and connection string button to generate the connection string and then click on the copy button to copy the string.
Lastly, paste the connection string to the appsettings.json to replace the current connection string.
Level 3
Asia Pacific University of Technology & Innovation Page 5 of 22

Design and Developing Application in Cloud (CT071-3-5-3-DDAC) Azure Blob Storage and Visual Studio Connected Services
c.
Create a controller.
Estimation time for this section C: 10 Minutes
1. In Solution Explorer, create a Controllers folder. Then, right-click Controllers.
2. From the context menu, select Add > Controller.
3. In the Add Scaffold dialog box, select MVC Controller select Add.
Empty, and
4. In the Add Empty MVC Controller dialog box, name the controller BlobsController, and select Add.
5. Add the following using directives to the BlobsController.cs file:
using System.IO;
using Microsoft.Extensions.Configuration;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
Level 3
Asia Pacific University of Technology & Innovation
Page 6 of 22

Design and Developing Application in Cloud (CT071-3-5-3-DDAC) Azure Blob Storage and Visual Studio Connected Services
6. Connect to a storage account and get a container reference. Add a method called GetCloudBlobContainer that returns a CloudBlobContainer.
Level 3
Asia Pacific University of Technology & Innovation Page 7 of 22

Design and Developing Application in Cloud (CT071-3-5-3-DDAC) Azure Blob Storage and Visual Studio Connected Services
d. Create a blob container.
Estimation time for this section D: 15 Minutes
The following steps illustrate how to create a blob container:
1. In the BlobsController.cs, add a method called CreateBlobContainer that returns an ActionResult.
2. Get a CloudBlobContainer object that represents a reference to the desired blob container name.
CloudBlobContainer container = GetCloudBlobContainer();
3. Call the CloudBlobContainer.CreateIfNotExists method to create the container, if it does not yet exist. TheCloudBlobContainer.CreateIfNotExistsmethod
returns true if the container does not exist, and is successfully created. Otherwise, the method returns false.
ViewBag.Success = container.CreateIfNotExistsAsync().Result;
4. Update ViewBag with the name of the blob container. ViewBag.BlobContainerName = container.Name;
5. The following shows the completed CreateBlobContainer method:
6. In Solution Explorer, right-click the Views folder. From the context menu, select Add > New Folder. Name the new folder Blobs.
Level 3
Asia Pacific University of Technology & Innovation Page 8 of 22

Design and Developing Application in Cloud (CT071-3-5-3-DDAC) Azure Blob Storage and Visual Studio Connected Services
Level 3
Asia Pacific University of Technology & Innovation Page 9 of 22
7. In Solution Explorer, expand the Views folder, and right-click Blobs.
8. From the context menu, select Add > View.
9. In the Add MVC View box, enter CreateBlobContainer for the view name, and select Add.
10.OpenCreateBlobContainer.cshtml, and modify it so that it looks like the following code snippet:

Design and Developing Application in Cloud (CT071-3-5-3-DDAC) Azure Blob Storage and Visual Studio Connected Services
11. In Solution Explorer, expand the Views > Shared folder, and
open _Layout.cshtml. Look for the unordered list that looks like this:

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] html SAS SQL database network Go Design and Developing Application in Cloud (CT071-3-5-3-DDAC) Azure Blob Storage and Visual Studio Connected Services
$25