1. Home
  2. Training Library
  3. Microsoft Azure
  4. Courses
  5. Introduction to Azure App Service

Creating a Simple App

Start course
Overview
Difficulty
Beginner
Duration
14m
Students
3718
Ratings
4.9/5
starstarstarstarstar-half
Description

This course explores Azure App Service, which makes deploying a web application as easy as possible by managing the underlying infrastructure for you. You'll learn the basics of Azure App Service before following along with a guided demo of how to create a simple app. We'll also take a look at how to configure an App Service Plan.

Learning Objectives

  • Understand the basics of Azure App Service
  • Learn how to create a simple app using the service
  • Learn how to configure an App Service Plan

Intended Audience

This course is intended for anyone who wants to get started with hosting web apps on Azure.

Prerequisites

To get the most from this course, you should already have some basic experience using Azure. If you don’t have any experience with Azure, then you can take our Microsoft Azure Fundamentals learning path.

Transcript

Now I’ll show you how easy it is to deploy an application on Azure App Service. In fact, it only takes one command to do it.

There are a few different options for where we could deploy it from. We could use Visual Studio, Visual Studio Code, or the Azure Command-Line Interface. I’m going to use the Azure CLI because it’s possible to use it without having to install anything. Microsoft provides something called the Cloud Shell that brings up a small virtual machine that has the Azure CLI and other tools installed on it.

To open it, you click here in the Azure Portal. If you haven’t used it before, then it’ll ask you for permission to create a storage account that the Cloud Shell VM can use. But I’ve used it before, so it comes right up.

Before we can deploy an app, we need to get one from somewhere. I’m going to use a sample .NET application. To get it, you can type this command.[dotnet new webapp -n MyFirstAzureWebApp -f net6.0 && cd MyFirstAzureWebApp] To save you some typing, I’ve included this command in the transcript below. This command also moves you into the MyFirstAzureWebApp folder, which is where the app was downloaded.

Now that we have the app, we can deploy it to App Service using this command.[az webapp up --sku F1 --name <app-name>] The “az” means it’s an Azure command. “webapp” is the command for App Service. “up” tells it to create the web app using the code in the current directory. “sku F1” means that we want to use the free tier so we won’t be charged for this service. I’ll explain more about service tiers later. Then we say “--name” and what we want to call the app. I’m calling it “ca” for Cloud Academy”, “webapp”. You’ll have to call it something else because the name has to be unique among all of the App Service names across all Azure customers.

There are quite a few other options we can add, but we can get away with only including these ones. Some of the other most common options are:

  • --resource-group for the resource group that it will put your App Service instance in
  • --location to specify the Azure region where your app will be hosted
  • --plan to specify which App Service Plan to use. I’ll tell you more about this in the next lecture.
  • --os-type, which can be either Windows or Linux. If you don’t specify one, then it’ll default to “Windows”.

Since we didn’t specify any of these options, it’s going to create a new resource group and a new App Service Plan using default names, it will put everything in your default location, and it will use Windows for the operating system.

[Hit Enter]Okay, this is going to take a while, so I’ll fast-forward.

All right, it’s done. You can see the choices it made for the options we left out. For example, here’s what it called the App Service Plan, and here’s what it called the resource group.

Now to bring up the app we just deployed, we can use this link. We can click on it, but notice that it’s going to include the quote at the end, so it’ll give us an error. That’s okay because we can just remove the extra bit at the end.

That’s better. This is a very simple web page because that’s all that’s in the sample app. Now, suppose we wanted to make a change to the app. Normally, you’d probably do that in either Visual Studio or Visual Studio Code, but we can actually do it from Cloud Shell, too.

If you click here, it’ll bring up an editor. First, we’ll go into the MyFirstAzureWebApp folder, and then go into the Pages folder, which is where we’ll find the home page for our app. It’s called Index.cshtml.

Right now, the main text on the home page is just “Welcome”. Let’s change it to “Welcome to Azure”. Now we’ll save it and then close the editor.

Okay, we’re back at the command line. If we hit the up arrow, it’ll bring back our previous command. To update our app, we’ll use the “az webapp up” command again, but this time, we don’t need to specify the sku or the name.[Erase them and hit Enter.] I’ll fast-forward again.

All right, it’s done. Now if we go back to the web page and hit refresh, you’ll see that the message changed to “Welcome to Azure”, so it worked.

 

And that’s it for creating and updating a simple app.

About the Author
Students
174962
Courses
98
Learning Paths
147

Guy launched his first training website in 1995 and he's been helping people learn IT technologies ever since. He has been a sysadmin, instructor, sales engineer, IT manager, and entrepreneur. In his most recent venture, he founded and led a cloud-based training infrastructure company that provided virtual labs for some of the largest software vendors in the world. Guy’s passion is making complex technology easy to understand. His activities outside of work have included riding an elephant and skydiving (although not at the same time).