|
| 1 | +--- |
| 2 | +title: Configure apps in the portal - Azure App Service |
| 3 | +description: Learn to configure common settings for an App Service app in the Azure portal. |
| 4 | +keywords: azure app service, web app, app settings, environment variables |
| 5 | +services: app-service\web |
| 6 | +documentationcenter: '' |
| 7 | +author: cephalin |
| 8 | +manager: erikre |
| 9 | +editor: '' |
| 10 | + |
| 11 | +ms.assetid: 9af8a367-7d39-4399-9941-b80cbc5f39a0 |
| 12 | +ms.service: app-service |
| 13 | +ms.workload: na |
| 14 | +ms.tgt_pltfrm: na |
| 15 | +ms.devlang: na |
| 16 | +ms.topic: article |
| 17 | +ms.date: 04/25/2017 |
| 18 | +ms.author: cephalin |
| 19 | +ms.custom: seodec18 |
| 20 | + |
| 21 | +--- |
| 22 | +# Configure an App Service app in the Azure portal |
| 23 | + |
| 24 | +This topic explains how to configure common settings for web apps, mobile back end, or API app using the [Azure portal]. |
| 25 | + |
| 26 | +## Configure app settings |
| 27 | + |
| 28 | +In App Service, you use app settings like environment variables. In the [Azure portal], navigate to your app's management page. In the app's left menu, click **Configuration** > **Application settings**. |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | +For ASP.NET and ASP.NET Core developers, setting app settings in App Service are like setting them in `<appSettings>` in *Web.config*, but the values in App Service override the ones in *Web.config*. You can keep development settings (e.g. local MySQL password) in *Web.config*, but production secrets (e.g. Azure MySQL database password) safe in App Service. The same code uses your development settings when you debug locally, and it uses your production secrets when deployed to Azure. |
| 33 | + |
| 34 | +Other language stacks, likewise, get the app settings as environment variables at runtime. For language-stack specific steps, see: |
| 35 | + |
| 36 | +- [ASP.NET Core](containers/configure-language-dotnetcore.md#access-environment-variables) |
| 37 | +- [Node.js](containers/configure-language-nodejs.md#access-environment-variables) |
| 38 | +- [PHP](containers/configure-language-php.md#access-environment-variables) |
| 39 | +- [Python](containers/how-to-configure-python.md#access-environment-variables) |
| 40 | +- [Java](containers/configure-language-java.md#data-sources) |
| 41 | +- [Ruby](containers/configure-language-ruby.md#access-environment-variables) |
| 42 | +- [Custom containers](containers/configure-custom-container.md#configure-environment-variables) |
| 43 | + |
| 44 | +App settings are always encrypted when stored (encrypted-at-rest). |
| 45 | + |
| 46 | +> [!NOTE] |
| 47 | +> App settings can also be resolved from [Key Vault](/azure/key-vault/) using [Key Vault references](app-service-key-vault-references.md). |
| 48 | +
|
| 49 | +### Show hidden values |
| 50 | + |
| 51 | +By default, values for app settings are hidden in the portal for security. To see a hidden value of an app setting, click the **Value** field of that setting. To see the values of all app settings, click the **Show value** button. |
| 52 | + |
| 53 | +### Add or edit |
| 54 | + |
| 55 | +To add a new app setting, click **New application setting**. In the dialog, you can [stick the setting to the current slot](deploy-staging-slots.md#which-settings-are-swapped). |
| 56 | + |
| 57 | +To edit a setting, click the **Edit** button on the right side. |
| 58 | + |
| 59 | +When finished, click **Update**. Don't forget to click **Save** back in the **Configuration** page. |
| 60 | + |
| 61 | +> [!NOTE] |
| 62 | +> In a default Linux container or a custom Linux container, any nested JSON key structure in the app setting name like `ApplicationInsights:InstrumentationKey` needs to be configured in App Service as `ApplicationInsights__InstrumentationKey` for the key name. In other words, any `:` should be replaced by `__` (double underscore). |
| 63 | +> |
| 64 | +
|
| 65 | +### Edit in bulk |
| 66 | + |
| 67 | +To add or edit app settings in bulk, click the **Advanced edit** button. When finished, click **Update**. Don't forget to click **Save** back in the **Configuration** page. |
| 68 | + |
| 69 | +App settings have the following JSON formatting: |
| 70 | + |
| 71 | +```json |
| 72 | +[ |
| 73 | + { |
| 74 | + "name": "<key-1>", |
| 75 | + "value": "<value-1>", |
| 76 | + "slotSetting": false |
| 77 | + }, |
| 78 | + { |
| 79 | + "name": "<key-2>", |
| 80 | + "value": "<value-2>", |
| 81 | + "slotSetting": false |
| 82 | + }, |
| 83 | + ... |
| 84 | +] |
| 85 | +``` |
| 86 | + |
| 87 | +## Configure connection strings |
| 88 | + |
| 89 | +In the [Azure portal], navigate to the app's management page. In the app's left menu, click **Configuration** > **Application settings**. |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | +For ASP.NET and ASP.NET Core developers, setting connection strings in App Service are like setting them in `<connectionStrings>` in *Web.config*, but the values you set in App Service override the ones in *Web.config*. You can keep development settings (e.g. a database file) in *Web.config* and production secrets (e.g. SQL Database credentials) safe in App Service. The same code uses your development settings when you debug locally, and it uses your production secrets when deployed to Azure. |
| 94 | + |
| 95 | +For other language stacks, it's better to use [app settings](#configure-app-settings) instead, because connection strings require special formatting in the variable keys in order to access the values. Here's one exception, however: certain Azure database types are backed up along with the app if you configure their connection strings in your app. For more information, see [What gets backed up](manage-backup.md#what-gets-backed-up). If you don't need this automated backup, then use app settings. |
| 96 | + |
| 97 | +At runtime, connection strings are available as environment variables, prefixed with the following connection types: |
| 98 | + |
| 99 | +* SQL Server: `SQLCONNSTR_` |
| 100 | +* MySQL: `MYSQLCONNSTR_` |
| 101 | +* SQL Database: `SQLAZURECONNSTR_` |
| 102 | +* Custom: `CUSTOMCONNSTR_` |
| 103 | + |
| 104 | +For example, a MySql connection string named *connectionstring1* can be accessed as the environment variable `MYSQLCONNSTR_connectionString1`. For language-stack specific steps, see: |
| 105 | + |
| 106 | +- [ASP.NET Core](containers/configure-language-dotnetcore.md#access-environment-variables) |
| 107 | +- [Node.js](containers/configure-language-nodejs.md#access-environment-variables) |
| 108 | +- [PHP](containers/configure-language-php.md#access-environment-variables) |
| 109 | +- [Python](containers/how-to-configure-python.md#access-environment-variables) |
| 110 | +- [Java](containers/configure-language-java.md#data-sources) |
| 111 | +- [Ruby](containers/configure-language-ruby.md#access-environment-variables) |
| 112 | +- [Custom containers](containers/configure-custom-container.md#configure-environment-variables) |
| 113 | + |
| 114 | +Connection strings are always encrypted when stored (encrypted-at-rest). |
| 115 | + |
| 116 | +> [!NOTE] |
| 117 | +> Connection strings can also be resolved from [Key Vault](/azure/key-vault/) using [Key Vault references](app-service-key-vault-references.md). |
| 118 | +
|
| 119 | +### Show hidden values |
| 120 | + |
| 121 | +By default, values for connection strings are hidden in the portal for security. To see a hidden value of a connection string, just click the **Value** field of that string. To see the values of all connection strings, click the **Show value** button. |
| 122 | + |
| 123 | +### Add or edit |
| 124 | + |
| 125 | +To add a new connection string, click **New connection string**. In the dialog, you can [stick the connection string to the current slot](deploy-staging-slots.md#which-settings-are-swapped). |
| 126 | + |
| 127 | +To edit a setting, click the **Edit** button on the right side. |
| 128 | + |
| 129 | +When finished, click **Update**. Don't forget to click **Save** back in the **Configuration** page. |
| 130 | + |
| 131 | +### Edit in bulk |
| 132 | + |
| 133 | +To add or edit connection strings in bulk, click the **Advanced edit** button. When finished, click **Update**. Don't forget to click **Save** back in the **Configuration** page. |
| 134 | + |
| 135 | +Connection strings have the following JSON formatting: |
| 136 | + |
| 137 | +```json |
| 138 | +[ |
| 139 | + { |
| 140 | + "name": "name-1", |
| 141 | + "value": "conn-string-1", |
| 142 | + "type": "SQLServer", |
| 143 | + "slotSetting": false |
| 144 | + }, |
| 145 | + { |
| 146 | + "name": "name-2", |
| 147 | + "value": "conn-string-2", |
| 148 | + "type": "PostgreSQL", |
| 149 | + "slotSetting": false |
| 150 | + }, |
| 151 | + ... |
| 152 | +] |
| 153 | +``` |
| 154 | + |
| 155 | +<a name="platform"></a> |
| 156 | +<a name="alwayson"></a> |
| 157 | + |
| 158 | +## Configure general settings |
| 159 | + |
| 160 | +In the [Azure portal], navigate to the app's management page. In the app's left menu, click **Configuration** > **Application settings**. |
| 161 | + |
| 162 | + |
| 163 | + |
| 164 | +Here, you can configure some common settings for the app. Some settings require you to [scale up to higher pricing tiers](web-sites-scale.md). |
| 165 | + |
| 166 | +- **Stack settings**: The software stack to run the app, including the language and SDK versions. For Linux apps and custom container apps, you can also set an optional start-up command or file. |
| 167 | +- **Platform settings**: Lets you configure settings for the hosting platform, including: |
| 168 | + - **Bitness**: 32-bit or 64-bit. |
| 169 | + - **WebSocket protocol**: For [ASP.NET SignalR] or [socket.io](https://socket.io/), for example. |
| 170 | + - **Always On**: Keep the app loaded even when there's no traffic. You need to enable it for continuous WebJobs or for WebJobs that are triggered using a CRON expression. |
| 171 | + - **Managed pipeline version**: The IIS [pipeline mode]. Set it to **Classic** if you have a legacy app that requires an older version of IIS. |
| 172 | + - **HTTP version**: Set to **2.0** to enable support for [HTTPS/2](https://wikipedia.org/wiki/HTTP/2) protocol. |
| 173 | + > [!NOTE] |
| 174 | + > Most modern browsers support HTTP/2 protocol over TLS only, while non-encrypted traffic continues to use HTTP/1.1. To ensure that client browsers connect to your app with HTTP/2, either [buy an App Service Certificate](web-sites-purchase-ssl-web-site.md) for the app's custom domain or [bind a third party certificate](app-service-web-tutorial-custom-ssl.md). |
| 175 | + - **ARR affinity**: In a multi-instance deployment, ensure that the client is routed to the same instance for the life of the session. You can set this option to **Off** for stateless applications. |
| 176 | +- **Debugging**: Enable remote debugging for [ASP.NET](troubleshoot-dotnet-visual-studio.md#remotedebug), [ASP.NET Core](/visualstudio/debugger/remote-debugging-azure), or [Node.js](containers/configure-language-nodejs.md#debug-remotely) apps. This option turns off automatically after 48 hours. |
| 177 | +- **Incoming client certificates**: require client certificates in [mutual authentication](app-service-web-configure-tls-mutual-auth.md). |
| 178 | + |
| 179 | +## Configure default documents |
| 180 | + |
| 181 | +This setting is only for Windows apps. |
| 182 | + |
| 183 | +In the [Azure portal], navigate to the app's management page. In the app's left menu, click **Configuration** > **Default documents**. |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | +The default document is the web page that's displayed at the root URL for a website. The first matching file in the list is used. To add a new default document, click **New document**. Don't forget to click **Save**. |
| 188 | + |
| 189 | +If the app uses modules that route based on URL instead of serving static content, there is no need for default documents. |
| 190 | + |
| 191 | +## Configure path mappings |
| 192 | + |
| 193 | +In the [Azure portal], navigate to the app's management page. In the app's left menu, click **Configuration** > **Path mappings**. |
| 194 | + |
| 195 | + |
| 196 | + |
| 197 | +The **Path mappings** page shows you different things based on the OS type. |
| 198 | + |
| 199 | +### Windows apps (uncontainerized) |
| 200 | + |
| 201 | +For Windows apps, you can customize the IIS handler mappings and virtual applications and directories. |
| 202 | + |
| 203 | +Handler mappings let you add custom script processors to handle requests for specific file extensions. To add a custom handler, click **New handler**. Configure the handler as follows: |
| 204 | + |
| 205 | +- **Extension**. The file extension you want to handle, such as *\*.php* or *handler.fcgi*. |
| 206 | +- **Script processor**. The absolute path of the script processor to you. Requests to files that match the file extension are processed by the script processor. Use the path `D:\home\site\wwwroot` to refer to your app's root directory. |
| 207 | +- **Arguments**. Optional command-line arguments for the script processor. |
| 208 | + |
| 209 | +Each app has the default root path (`/`) mapped to `D:\home\site\wwwroot`, where your code is deployed by default. If your app root is in a different folder, or if your repository has more than one application, you can edit or add virtual applications and directories here. Click **New virtual application or directory**. |
| 210 | + |
| 211 | +To configure virtual applications and directories, specify each virtual directory and its corresponding physical path relative to the website root (`D:\home`). Optionally, you can select the **Application** checkbox to mark a virtual directory as an application. |
| 212 | + |
| 213 | +### Containerized apps |
| 214 | + |
| 215 | +You can [add custom storage for your containerized app](containers/how-to-serve-content-from-azure-storage.md). Containerized apps include all Linux apps and also the Windows and Linux custom containers running on App Service. Click **New Azure Storage Mount** and configure your custom storage as follows: |
| 216 | + |
| 217 | +- **Name**: The display name. |
| 218 | +- **Configuration options**: **Basic** or **Advanced**. |
| 219 | +- **Storage accounts**: The storage account with the container you want. |
| 220 | +- **Storage type**: **Azure Blobs** or **Azure Files**. |
| 221 | + > [!NOTE] |
| 222 | + > Windows container apps only support Azure Files. |
| 223 | +- **Storage container**: For basic configuration, the container you want. |
| 224 | +- **Share name**: For advanced configuration, the file share name. |
| 225 | +- **Access key**: For advanced configuration, the access key. |
| 226 | +- **Mount path**: The absolute path in your container to mount the custom storage. |
| 227 | + |
| 228 | +For more information, see [Serve content from Azure Storage in App Service on Linux](containers/how-to-serve-content-from-azure-storage.md). |
| 229 | + |
| 230 | +## Configure language stack settings |
| 231 | + |
| 232 | +For Linux apps, see: |
| 233 | + |
| 234 | +- [ASP.NET Core](containers/configure-language-dotnetcore.md) |
| 235 | +- [Node.js](containers/configure-language-nodejs.md) |
| 236 | +- [PHP](containers/configure-language-php.md) |
| 237 | +- [Python](containers/how-to-configure-python.md) |
| 238 | +- [Java](containers/configure-language-java.md) |
| 239 | +- [Ruby](containers/configure-language-ruby.md) |
| 240 | + |
| 241 | +## Configure custom containers |
| 242 | + |
| 243 | +See [Configure a custom Linux container for Azure App Service](containers/configure-custom-container.md) |
| 244 | + |
| 245 | +## Next steps |
| 246 | + |
| 247 | +- [Configure a custom domain name in Azure App Service] |
| 248 | +- [Set up staging environments in Azure App Service] |
| 249 | +- [Enable HTTPS for an app in Azure App Service] |
| 250 | +- [Enable diagnostic logs](troubleshoot-diagnostic-logs.md) |
| 251 | +- [Scale an app in Azure App Service] |
| 252 | +- [Monitoring basics in Azure App Service] |
| 253 | +- [Change applicationHost.config settings with applicationHost.xdt](https://github.com/projectkudu/kudu/wiki/Xdt-transform-samples) |
| 254 | + |
| 255 | +<!-- URL List --> |
| 256 | + |
| 257 | +[ASP.NET SignalR]: https://www.asp.net/signalr |
| 258 | +[Azure Portal]: https://portal.azure.com/ |
| 259 | +[Configure a custom domain name in Azure App Service]: ./app-service-web-tutorial-custom-domain.md |
| 260 | +[Set up staging environments in Azure App Service]: ./deploy-staging-slots.md |
| 261 | +[Enable HTTPS for an app in Azure App Service]: ./app-service-web-tutorial-custom-ssl.md |
| 262 | +[How to: Monitor web endpoint status]: https://go.microsoft.com/fwLink/?LinkID=279906 |
| 263 | +[Monitoring basics in Azure App Service]: ./web-sites-monitor.md |
| 264 | +[pipeline mode]: https://www.iis.net/learn/get-started/introduction-to-iis/introduction-to-iis-architecture#Application |
| 265 | +[Scale an app in Azure App Service]: ./web-sites-scale.md |
0 commit comments