Road To AZ-204 - Creating Azure App Service Web Apps

Introduction

This article's intention is to explain the main skills measured in this sub-topic of the AZ-204 Certification. The main topic here is Azure Web Apps and we are going through creating, deploying, logging, auto-scaling, and configuring Azure Web Apps. Those techniques will have their fundamentals explained here, alongside a practical example.

This certification is very extensive and this article approaches only the main topics, make sure you know those components deeply before taking the exam. Another great tip is doing exam simulators before the official exam in order to validate your knowledge.

What is the Certification AZ-204 - Developing Solutions for Microsoft Azure?

The AZ-204 - Developing Solutions for Microsoft Azure certification measures designing, building, testing, and maintaining skills of an application and/or service in a Microsoft Azure Cloud environment. It approaches, among others, the following components:

  • Azure Virtual Machines
  • Docker
  • Azure Containers
  • Service Web App
  • Azure Functions
  • Cosmos DB
  • Azure Storage
  • Azure AD
  • Azure Key Vault
  • Azure Managed Identities
  • Azure Redis Cache
  • Azure Logic App
  • Azure Event Grid
  • Azure Event Hub
  • Azure Notification Hub
  • Azure Service Bus
  • Azure Queue Storage

Check more information on the AZ - 204 Developing Solutions for Microsoft Azure Official Website.

Target Audience

Any IT professional willing to improve his knowledge in Microsoft Azure is encouraged to take this certification, it is a great way to measure your skills within trending technologies. But, some groups of professionals are keener to take maximum advantage of it:

  • Azure Developers, with at least 1 year of experience with Microsoft Azure;
  • Experienced Software Developers, looking for an Architect position in a hybrid environment;
  • Software Developers, working to move applications to the cloud environment.

Skills Measured

According to today's date, the skills that are measured in the exam are split as follows.

  • Develop Azure compute solutions (25-30%)
  • Develop for Azure storage (10-15%)
    • Develop solutions that use Cosmos DB storage
    • Develop solutions that use blob storage
  • Implement Azure security (15-20%)
    • Implement user authentication and authorization
    • Implement secure cloud solutions
  • Monitor, troubleshoot, and optimize Azure solutions (10-15%)
    • Integrate caching and content delivery within solutions
    • Instrument solutions to support monitoring and logging
  • Connect to and consume Azure services and third-party services (25- 30%)
    • Develop an App Service Logic App
    • Implement API Management
    • Develop event-based solutions
    • Develop message-based solutions

Updated skills can be found on the AZ - 204 Measured Skills Website.

Benefits of Getting Certified

The main benefit here is having a worldwide recognized certification that proves that you have knowledge of this topic. Among intrinsic and extrinsic benefits, we have:

  • Higher growth potential, as certifications, are a big plus.
  • Discounts and deals in Microsoft products and partners, like PluralSight and UpWork.
  • MCP Newsletters, with trending technologies.
  • Higher exposure on LinkedIn, as recruiters usually search for specific certifications.
  • Higher salary, you will be more valuable to your company.
  • Unique happiness when getting the result and you were approved, knowing that all your efforts were worth it.

Official Microsoft Certification Program Benefits Website.

Main Skills Measured by this Topic
 

What is an Azure Web App?

An Azure Web App is an Azure Service focused on Web Applications, you may deploy your Web Applications and Rest APIs in .NET, .NET Core, Java, Ruby, Node.js, PHP, or Python in a Windows or Linux environment paying only for the used resources. Azure Web Apps are great if you do not mind about the website infrastructure and your only concern is to have your Web App running online because Azure offers many built-in infrastructure features as.

  • Security
  • Load Balancing
  • Autoscaling
  • Automated Management
  • Easy and fast integration with Azure DevOps

Read more about Azure App Services: Web App.

SKUs and Sizes

Azure App Service offers different types of Skus in order to attend different types of needs. It has since free shared SKUs to Isolated Service Plans, where you have a range of different sizes. You may check the list of available combinations of Skus and Sizes below, according to the Virtual Machine operational system that hosts your Azure App Service.

Runtime Stack

Azure App Service hosts applications running in the main technology stack, like .NET, .NET Core, Java, Ruby, Node.js, PHP, or Python

Why diagnostics logging?

Diagnostics logging is a vital part of any Web Application operation, with logs you may troubleshoot exceptions, non-exception errors, alerts, and warnings, and also, track the user experience in order to improve it.

With Azure Diagnostics Logging you may log.

  • Application events generated by your app.
  • Web Server logging, with a raw version of requests made to your app. Only available for the Windows platform.
  • Detailed Error Pages, saving copies of the error pages presented to your user. Only available for the Windows platform.
  • Failed request tracing, with detailed information regarding failed requests. Only available for the Windows platform.
  • Deployment logging, logging detailed information about the deployment process in order to troubleshoot when a deployment fails.

Read more about diagnostics logging.

What is AutoScale?

Autoscaling is the process of adjusting a server infrastructure capability in order to fulfill incoming requests from your web application. It usually takes seconds for the changes to take effect and can be done automatically according to pre-configured metrics. It does not need any new deployment or coding.

There are 2 options for scaling an app.

  1. Horizontal: when you add/remove web servers from your load balancer. Example: increasing from 1 Virtual Machine to 3 Virtual Machines during peak hours.
  2. Vertical: adding/removing resources from your web servers, such as CPU, memory, or storage. Example: increase your storage capacity in order to store more logs.

Read more about scaling apps.

Configuring Azure Web App Settings

Your Azure Web Apps settings can be easily configured through Azure CLI or Azure Portal, with the possibility to edit in bulk through the Azure Portal. The main settings that may be configured for your Azure Web App are the following.

  • SSL, to have a secure and encrypted communication channel.
  • API Settings, like technology stack or platform settings.
  • APP Settings, to override your configs stored on the Web.Config.
  • Connection Strings, in order to not have it written on the Web.Config.
  • Default Documents, displaying default web pages when accessing the root of your Website URL.
  • Path Mappings, configuring settings according to the user's OS.

Read more about Web Apps Settings.

Creating an Azure App Service Web App

You may find the project used in the following steps here.

Though Visual Studio

Right-click on the Web Project and click on Publish. Then, select Azure and click Next.

Visual Studio

Select App Service. Here we are going to use the Azure App Service ( Windows ).

 App Service

Create a new Azure App Service.

Publish

Select your App Service Name, Subscription, Resource Group, and Hosting Plan. You can also create a new Resource Group or Hosting Plan to host your Azure App Service.

Resource

After Azure validates your input data, select the recently created Azure App Service, and click finish. A new publish profile will be visible and your Azure Web App is already created.

Finish

Through Azure Portal

Select the Web App Resource.

Web app

Select your Web App Settings like Name, Resource Group, Runtime Stack, Operating System, Region, and App Service Plan. You can also configure Application Insights and tags here and then click on Review + Create.

Create Web

After Azure runs its validation, click on Create. After a successful deployment, go to your recently created resource.

Deployment

If you check on your App Service URL, you can see that it is already online with Azure Default Empty Template.

 Service URL

Enabling diagnostics logging

Go to your App Service and then, under Monitoring, select App Service logs.

Logging

Log files location

Example for Windows apps.

https://netcorecalculator20201013202205.scm.azurewebsites.net/api/dump

Application logging

You may log your files to a Filesystem or to a Blob. For storing Application logs in blobs, you need to select an Azure Storage Account.

You have to select the level of logs to be stored and for Application Logging using Blob, you also have to set retention days to purge old files in order to clean space.

Clean Space

Web Server logging

Log into Azure Storage. You need to configure your Azure Storage account that will store the logs alongside the logs retention period.

Server logging 

Log into the File System. You have to select the quota limit of logs to be stored and also the retention period.

File System

Detailed Error Logs

It is enabled here but you need to configure the logs in your code.

 Error Logs

Read more about logging in .Net Core.

Failed Request Traces

Very simple to enable.

Request Traces

Streaming Logs

Go to your App Service and then, under Monitoring, select Log Stream. You may select to see Application logs or Web Server Logs.

Streaming Logs 

Deploying code to a web app
 

Through Visual Studio

Right-click on the Web App Project and click on publish, you will be redirected to your Publish Profile. Validate your settings and click on Publish.

 Web app 

After deployment success, you will be redirected to your new Azure App Service.

Deploy success

Configuring web app settings including SSL, API, and connection strings

Configuring your API and APP Settings and your Connection Strings and Application Maps.

Go to your App Service and then to Configuration.

Configuration 

Application Settings, grouped by Key-Value pairs.

 Key-Value

Connection Strings, with name, value, and database type.

 Database type

General Settings, like technology stack, platform settings, remote debugging, and client certificates.

 Client certificates

Default Documents, to be displayed in the root of your Website URL.

 Website URL

Path Mappings, to configure your handler mappings and virtual applications/directories.

Virtual applications

Configuring SSL

Go to your App Service and then TSL/SSL settings.

Here you can configure your Web App bindings, import your existing certificates, or buy a new certificate.

Configuring SSL

Azure App Service Scaling

In all sub-topics, here we are going to be talking about horizontal scaling, which means that we are going to upgrade the number of instances that host our Web App.

  • For horizontal scaling, or scaling out, go to your App Service and under Settings select Scale-out.
  • For vertical scaling, or scaling up, go to your App Service and under Settings select Scale-up.

Scaling Manually

Change the number of instances and click on save.

Scaling

AutoScaling

By Scheduled periodicity, operational, and system metrics. Select a Scale based on a metric.

AutoScaling

Instance limits

Have the minimum, maximum, and default amount of instances to be running according to your rules. According to your scaling rules your number of running instances is going to float from maximum to minimum, staying in the default if no rule is triggered.

Schedule

You may schedule your rule to be executed in a specific range of dates or to be repeated every week on specific weekdays. You can also configure the timezone and range of time where your scaling rules will be applied.

Scaling Rules

Scaling Rules

Criteria

Here we define the criteria that have to be met in order to take any scaling action.

  • Time Aggregation defines the range of time that will be used in order to aggregate the metrics. For example, Time Aggregation = “Average” should aggregate the sampled metrics by taking the average.
  • Metric Name defines the name of the metric used to evaluate these criteria.
  • Time Grain Statistics defines the metric sampling type.
  • The operator defines the comparison operator.
  • The threshold defines the target value to trigger this scaling criterion.
  • Duration defines the amount of time the scale criteria will look back.

Action

Here we define the action that will be executed when the criteria are met.

  • Operation defines which type of operation we want to execute, like increasing or decreasing the instance count.
  • Instance count defines the number of instances that will be increased or decreased.
  • Cooldown defines the waiting time in order to execute another action.

External References

  • Road To AZ-204 - Implementing IaaS solutions
  • Configure an App Service app in the Azure portal


Similar Articles