|
| 1 | +--- |
| 2 | +title: "App Services" |
| 3 | +description: Get started with Azure App Services on LocalStack |
| 4 | +template: doc |
| 5 | +--- |
| 6 | + |
| 7 | +import AzureFeatureCoverage from "../../../../components/feature-coverage/AzureFeatureCoverage"; |
| 8 | + |
| 9 | +## Introduction |
| 10 | + |
| 11 | +Azure App Service is a fully managed platform for hosting web applications, mobile backends, and RESTful APIs without infrastructure overhead. It supports multiple runtimes including .NET, Java, Node.js, Python, and PHP on both Windows and Linux, or as custom containers. For more information, see the [App Service overview](https://learn.microsoft.com/azure/app-service/overview). |
| 12 | + |
| 13 | +LocalStack for Azure provides a local environment for building and testing applications that make use of Azure App Services. |
| 14 | +The supported APIs are available on our [API Coverage section](#api-coverage), which provides information on the extent of Web App's integration with LocalStack. |
| 15 | + |
| 16 | +## Getting started |
| 17 | + |
| 18 | +This guide is designed for users new to Web App and assumes basic knowledge of the Azure CLI and our `azlocal` wrapper script. |
| 19 | + |
| 20 | +Launch LocalStack using your preferred method. For more information, see [Introduction to LocalStack for Azure](/azure/getting-started/). Once the container is running, enable Azure CLI interception by running: |
| 21 | + |
| 22 | + |
| 23 | +### Create a resource group |
| 24 | + |
| 25 | +Create a resource group for your Web App resources: |
| 26 | + |
| 27 | +```bash |
| 28 | +az group create \ |
| 29 | + --name rg-web-demo \ |
| 30 | + --location westeurope |
| 31 | +``` |
| 32 | + |
| 33 | +```bash title="Output" |
| 34 | +{ |
| 35 | + "name": "rg-web-demo", |
| 36 | + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-web-demo", |
| 37 | + "location": "westeurope", |
| 38 | + "properties": { |
| 39 | + "provisioningState": "Succeeded" |
| 40 | + }, |
| 41 | + ... |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +### Create an App Service plan |
| 46 | + |
| 47 | +Create an App Service plan that will host the web app: |
| 48 | + |
| 49 | +```bash |
| 50 | +az appservice plan create \ |
| 51 | + --name asp-web-doc89 \ |
| 52 | + --resource-group rg-web-demo \ |
| 53 | + --location westeurope \ |
| 54 | + --sku B1 |
| 55 | +``` |
| 56 | + |
| 57 | +```bash title="Output" |
| 58 | +{ |
| 59 | + "name": "asp-web-doc89", |
| 60 | + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-web-demo/providers/Microsoft.Web/serverfarms/asp-web-doc89", |
| 61 | + "location": "westeurope", |
| 62 | + "provisioningState": "Succeeded", |
| 63 | + "sku": { |
| 64 | + "name": "B1", |
| 65 | + "tier": "Basic", |
| 66 | + ... |
| 67 | + }, |
| 68 | + ... |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | +### Create and inspect a Web App |
| 73 | + |
| 74 | +Create a web app using a Python runtime: |
| 75 | + |
| 76 | +```bash |
| 77 | +az webapp create \ |
| 78 | + --name ls-web-doc89 \ |
| 79 | + --resource-group rg-web-demo \ |
| 80 | + --plan asp-web-doc89 \ |
| 81 | + --runtime "PYTHON:3.11" |
| 82 | +``` |
| 83 | + |
| 84 | +```bash title="Output" |
| 85 | +{ |
| 86 | + "name": "ls-web-doc89", |
| 87 | + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-web-demo/providers/Microsoft.Web/sites/ls-web-doc89", |
| 88 | + "type": "Microsoft.Web/sites", |
| 89 | + "location": "westeurope", |
| 90 | + "defaultHostName": "ls-web-doc89.azurewebsites.azure.localhost.localstack.cloud:4566", |
| 91 | + "state": "Running", |
| 92 | + ... |
| 93 | +} |
| 94 | +``` |
| 95 | + |
| 96 | +Get the web app: |
| 97 | + |
| 98 | +```bash |
| 99 | +az webapp show \ |
| 100 | + --name ls-web-doc89 \ |
| 101 | + --resource-group rg-web-demo |
| 102 | +``` |
| 103 | + |
| 104 | +### Read and update web app configuration |
| 105 | + |
| 106 | +Read the current web app configuration: |
| 107 | + |
| 108 | +```bash |
| 109 | +az webapp config show \ |
| 110 | + --name ls-web-doc89 \ |
| 111 | + --resource-group rg-web-demo |
| 112 | +``` |
| 113 | + |
| 114 | +```bash title="Output" |
| 115 | +{ |
| 116 | + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-web-demo/providers/Microsoft.Web/sites/ls-web-doc89/config/web", |
| 117 | + "linuxFxVersion": "PYTHON|3.11", |
| 118 | + "http20Enabled": true, |
| 119 | + "alwaysOn": false, |
| 120 | + "ftpsState": "FtpsOnly", |
| 121 | + ... |
| 122 | +} |
| 123 | +``` |
| 124 | + |
| 125 | +Update the web app configuration: |
| 126 | + |
| 127 | +```bash |
| 128 | +az webapp config set \ |
| 129 | + --name ls-web-doc89 \ |
| 130 | + --resource-group rg-web-demo \ |
| 131 | + --always-on false \ |
| 132 | + --http20-enabled true |
| 133 | +``` |
| 134 | + |
| 135 | +```bash title="Output" |
| 136 | +{ |
| 137 | + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-web-demo/providers/Microsoft.Web/sites/ls-web-doc89", |
| 138 | + "http20Enabled": true, |
| 139 | + "alwaysOn": false, |
| 140 | + ... |
| 141 | +} |
| 142 | +``` |
| 143 | + |
| 144 | +### Configure application settings |
| 145 | + |
| 146 | +Set an application setting that instructs the SCM endpoint to build the application during deployment: |
| 147 | + |
| 148 | + |
| 149 | +## API Coverage |
| 150 | + |
| 151 | +<AzureFeatureCoverage service="Microsoft.Web" client:load /> |
0 commit comments