Azure Web Apps, a fully-managed Platform as a Service (PaaS) offered by Microsoft, empowers developers to build, deploy, and scale modern web applications. To kickstart your journey with Azure Web Apps, let's explore a simple and insightful "Hello, World!" sample code in ASP.NET Core.

ASP.NET Core is a cross-platform, high-performance, and open-source framework for building web applications and services. Here's how you can create a basic "Hello, World!" web app in C#, using Azure Web Apps as the deployment target.

Setting Up the "Hello, World!" Project in ASP.NET Core
Before diving into the code, ensure you have the .NET SDK installed on your machine. Then, create a new ASP.NET Core Web App (empty) project using the following command in your terminal:

dotnet new webapp -n HelloWorld
Implementing the "Hello, World!" Functionality

Navigate to the newly created project folder (HelloWorld) and open the Pages/Index.cshtml file. Replace its content with the following HTML code:
<!DOCTYPE html>
<html>
<head>
<title>Hello, World!</title>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
Now, let's update the Pages/Index.cshtml.cs C# code-behind file to include the necessary processing logic. Replace its content with the following code:
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace HelloWorld.Pages
{
public class IndexModel : PageModel
{
public void OnGet()
{
}
}
}
The provided code is minimalistic, as the ASP.NET Core framework handles most of the heavy lifting. The OnGet method simply ensures that the Index page is rendered when accessed.

Running the Application Locally
To run the project locally, execute the following command in the project's root folder:
dotnet run

Once the application starts, open your preferred web browser and navigate to http://localhost:5001. You should now see the message "Hello, World!" displayed prominently on the page.
Deploying the "Hello, World!" Web App to Azure




















Now that you have a functional "Hello, World!" web app, let's deploy it to Azure. First, create an Azure Web App using the Azure Portal, Azure CLI, or Azure PowerShell.
The following Azure CLI commands demonstrate how to create a new Web App and deploy the "Hello, World!" project:
az group create --name myResourceGroup --location CentralUS az appservice plan create --name myAppServicePlan --resource-group myResourceGroup --sku F1 az webapp create --resource-group myResourceGroup --plan myAppServicePlan --name myHelloWorldApp az webapp deploy --resource-group myResourceGroup --name myHelloWorldApp --src-directory . --publish-methodОбowski
The provided commands create a new resource group, app service plan, and web app, then deploy the local "Hello, World!" project to the newly created Azure Web App.
Verifying the Deployment
To validate the deployment, open your preferred web browser and navigate to http://myhello world.azurewebsites.net (replace myhello world with your unique web app name). The "Hello, World!" message should now be displayed on the Azure Web App.
Congratulations! You've successfully deployed your first ASP.NET Core web app to Azure using the "Hello, World!" sample project.
Embarking on your Azure Web Apps journey, you'll soon explore more advanced features like continuous deployment, scaling, and integrating with other Azure services. Happy coding!