Managing App Services

This document provides a comprehensive guide to managing your App Services, covering essential operations from creation and configuration to scaling and deletion.

Creating an App Service

You can create a new App Service through the Azure portal, Azure CLI, or programmatically using SDKs.

Using the Azure Portal

  1. Navigate to the Azure portal.
  2. Click on "Create a resource".
  3. Search for "Web App" or "App Service" and select it.
  4. Fill in the required details: Subscription, Resource Group, Name, Runtime Stack, Region, and App Service Plan.
  5. Click "Review + create" and then "Create".

Using Azure CLI

Use the following command to create a new App Service:

az webapp create --resource-group <resource-group-name> --name <app-name> --plan <app-service-plan-name> --runtime "dotnetcore|6.0"

Configuring Your App Service

App Services offer extensive configuration options to tailor your application's environment.

General Settings

Deployment Slots

Deployment slots allow you to manage multiple versions of your application in production without downtime. You can deploy to a staging slot, test it, and then swap it into production.

This is crucial for zero-downtime deployments.

App Service Plan

The App Service plan defines the location, size, features, cost, and computing resources of your app. You can scale your plan up or out.

Scaling Your App Service

App Services can be scaled manually or automatically based on performance metrics.

Manual Scaling

In the Azure portal, navigate to your App Service and under "Scale out (App Service plan)", you can manually adjust the number of instances.

Autoscaling

Autoscaling allows your application to scale up or down automatically based on predefined rules. You can configure rules based on CPU percentage, memory usage, HTTP queue length, and more.


# Example autoscaling rule for Azure CLI
az monitor autoscale create \
    --resource-group <resource-group-name> \
    --resource <app-service-plan-name> \
    --min-workers 1 \
    --max-workers 5 \
    --default-workers 2
        

Try Autoscaling (Simulated)

Click the button below to simulate an increase in load and observe how the number of instances would theoretically scale.

Current Instances: 1

Monitoring and Diagnostics

It's essential to monitor your App Service's performance and health. App Services integrate with Azure Monitor for comprehensive diagnostics.

Stopping and Deleting an App Service

You can stop an App Service to reduce costs when it's not in use. Deleting an App Service is a permanent action.

Stopping

In the Azure portal, under "Overview", you will find a "Stop" button.

Deleting

Navigate to your App Service in the Azure portal, click "Delete" at the top, and confirm your action. Remember to delete the associated App Service Plan if it's no longer needed.

Deleting an App Service is irreversible. Ensure you have backups or alternative arrangements if necessary.

For more advanced management tasks, refer to the API Reference.