Create Azure Resources for Your ASP.Net Application

 Create Your Azure Resources

First, let’s cover a few basics. Everything in Azure is a Resource. Resources are contained within a Subscription. An Azure Tenant can have one or more subscriptions.

Access to resources is controlled using Roles Based Access Control (RBAC). Delving into this and other governance topics is a blog post for another day.

Resources are grouped together in Resource Groups. Think of this as a folder into which you will place things you want to store.

Setup Portal

The first thing we need to do is log-in to the Azure portal, and then we will add some things to the favorites list to make access to them easier as we progress.

1. Open a browser window and navigate to https://portal.azure.com.
2. Enter your credentials, and you will be in the Azure portal home page, which should look something like this:
(Note that the Azure portal is constantly updating, so do not be surprised if your screen looks slightly different.) 

3. You will notice that under favorites I have a number of options, likely more than your new account will have. We should add the ones we will need for this blog post to make it quicker and easier for you to navigate the UI. From the Left Navigation select All Services:
4. On the list of All Services, click the star next to the following items:

Resource Groups
SQL Databases
SQL Servers
Application Insights
App Services
App Service Plans

Use the Search Everything box at the top to help find the items. For example:
Creating the Resource Group
We can now create the Resource Group, which will be used to hold all the resources we need. During the creation of many resources, you will have the ability to create Tags. Tags are used to help manage resources at scale and are out of scope for this blog.

1. Click on the Resource Group link in the Left Navigation that you added earlier.
2. The list of Resource Groups will be displayed.
3. Click the Add button at the top.

4. Ensure the correct subscription is selected if there are multiple subscriptions available. Enter a name for the resource group. Select the Region the resources are to be created in. Select Review and Create and complete the wizard to create the resource group. 
Note that depending on the region you select, charges and features may differ.

Create the Web Application
Next, we need to create the “virtual web server” and “web application” that the ASP.Net application will run on. We need to define the “virtual hardware” that the server will run on.

1. Click on App Service Plans.
2. From the list of App Service Plans, click Add.
3. On the Add App Service Plan dialog, ensure the subscription is correct. Select the Resource Group you created earlier.

Define a name for the Service Plan.

Select the Windows operating system.

Ensure that the Region is the same as the one used for the Resource Group. Azure tends to default to certain regions, and it does not always make sense. Pay close attention to the region that the resource is created in. It is possible for the different pieces of the infrastructure to be in different regions.

4. If you select the SKU size link, you can change between Dev/Test or Production Level Service Plans. Select the SKU Size (for the purposes of this demo, you can use the Standard S1). The SKU size determines the amount of resources assigned to the Service Plan; note that as you select different options the list of included features and hardware changes, as does the cost. The cost for the service plan is paid while it exists—unlike some resources which are consumption based—the App Service plan is paid for even if your web application is not being used. For more information, see: https://azure.microsoft.com/en-us/pricing/details/app-service/plans/.

Click Apply.

Click Review and Create, and then complete the wizard.

5. Now that we have created the App Service plan, we can create the web application. Note that Microsoft documentation is in the progress of changing from Web Apps to App Services—see: https://azure.microsoft.com/en-us/services/app-service/web/.

Click on the App Services link in the Navigation.
6. Click on Add.
7. Select the correct Subscription and resource group.
8. The monitoring tab allows you to create a new or bind the application to an existing Application Insights instance. Application Insights provides a cloud-based Application Performance Monitoring tool. It allows you to monitor the application performance for things such as requests per second, average response time and exceptions, along with much more.

It is a part of the Azure Monitor Product (See: https://azure.microsoft.com/en-us/services/monitor).
On the Monitoring tab, create a new Application Insights.

9. Review and Create.

10. Once the App Service has been provisioned, click on App Services.

Once the list of App Services is displayed, click the link for your App Service created earlier.

This will display the App Service Overview page. From this page in the Left Navigation, click Application Insights.

11. Set the options for Application Insights gathering.

Ensure it is enabled.

Set the level to Recommended.

Enable the Profiler.
Enable the Snapshot Debugger.
Show local variables.
Enable SQL Commands.
12. Click apply and confirm restart.
13. Navigate back to the Overview page for your App Service, and click the link to test that the endpoint is functioning:
14. The Web Application is operational! 

Post a Comment

0 Comments