You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: learn-pr/wwl-azure/configure-web-app-settings/includes/2-configure-application-settings.md
+25-9Lines changed: 25 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,24 @@
1
-
In App Service, app settings are variables passed as environment variables to the application code. For Linux apps and custom containers, App Service passes app settings to the container using the `--env` flag to set the environment variable in the container.
1
+
In App Service, app settings are variables passed as environment variables to the application code. For Linux apps and custom containers, App Service passes app settings to the container using the `--env` flag to set the environment variable in the container. In either case, they're injected into your app environment at app startup. When you add, remove, or edit app settings, App Service triggers an app restart.
2
2
3
-
Application settings can be accessed by navigating to your app's management page and selecting **Environment variables > Application settings**.
3
+
For ASP.NET and ASP.NET Core developers, setting app settings in App Service is like setting them in `<appSettings>` in *Web.config* or *appsettings.json*, but the values in App Service override the ones in *Web.config* or *appsettings.json*. You can keep development settings (for example, local MySQL password) in *Web.config* or *appsettings.json* and production secrets (for example, Azure MySQL database password) safely in App Service. The same code uses your development settings when you debug locally, and it uses your production secrets when deployed to Azure.
4
4
5
-
:::image type="content" source="../media/configure-app-settings.png" alt-text="Navigating to Environment variables > Application settings":::
5
+
App settings are always encrypted when stored (encrypted-at-rest). App settings names can only contain letters, numbers (0-9), periods ("."), and underscores ("_")
6
+
Special characters in the value of an App Setting must be escaped as needed by the target OS.
6
7
7
-
For ASP.NET and ASP.NET Core developers, setting app settings in App Service is like setting them in `<appSettings>` in *Web.config* or *appsettings.json*, but the values in App Service override the ones in *Web.config* or *appsettings.json*. You can keep development settings (for example, local MySQL password) in *Web.config* or *appsettings.json* and production secrets (for example, Azure MySQL database password) safely in App Service. The same code uses your development settings when you debug locally, and it uses your production secrets when deployed to Azure.
8
+
Application settings can be accessed by navigating to your app's management page and selecting **Environment variables > Application settings**.
8
9
9
-
App settings are always encrypted when stored (encrypted-at-rest).
10
+
:::image type="content" source="../media/configure-app-settings.png" alt-text="Screenshot of Navigating to Environment variables > Application settings.":::
10
11
11
12
## Adding and editing settings
12
13
13
-
To add a new app setting, select **+ Add**. If you're using deployment slots you can specify if your setting is swappable or not. In the dialog, you can stick the setting to the current slot.
14
+
To add a new app setting, select **+ Add**. If you're using deployment slots, you can specify if your setting is swappable or not. In the dialog, you can stick the setting to the current slot.
14
15
15
16
:::image type="content" source="../media/app-configure-slotsetting.png" alt-text="Selecting deployment slot setting to stick the setting to the current slot.":::
16
17
17
18
When finished, select **Apply**. Don't forget to select **Apply** back in the **Environment variables** page.
18
19
19
20
> [!NOTE]
20
-
> In a default Linux app service 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). Any periods in the app setting name will be replaced with a `_` (single underscore).
21
+
> In a default Linux app service 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, replace any `:`with `__` (double underscore). Any periods in the app setting name are replaced with a `_` (single underscore).
21
22
22
23
### Editing application settings in bulk
23
24
@@ -44,7 +45,7 @@ To add or edit app settings in bulk, select the **Advanced edit** button. When f
44
45
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*. For other language stacks, it's better to use app settings instead, because connection strings require special formatting in the variable keys in order to access the values.
45
46
46
47
> [!TIP]
47
-
> There is one case where you may want to use connection strings instead of app settings for non-.NET languages: certain Azure database types are backed up along with the app *only* if you configure a connection string for the database in your App Service app.
48
+
> There's one case where you may want to use connection strings instead of app settings for non-.NET languages: certain Azure database types are backed up along with the app *only* if you configure a connection string for the database in your App Service app.
48
49
49
50
Adding and editing connection strings follow the same principles as other app settings and they can also be tied to deployment slots. An example of connection strings in JSON formatting that you would use for bulk adding or editing:
50
51
@@ -67,7 +68,22 @@ Adding and editing connection strings follow the same principles as other app se
67
68
```
68
69
69
70
> [!NOTE]
70
-
> .NET apps targeting PostgreSQL should set the connection string to **Custom** as workaround for a known issue in .NET EnvironmentVariablesConfigurationProvider.
71
+
> .NET apps targeting PostgreSQL should set the connection string to **Custom** as work around for a known issue in .NET `EnvironmentVariablesConfigurationProvider`.
72
+
73
+
At runtime, connection strings are available as environment variables, prefixed with the following connection types:
74
+
75
+
* SQLServer: `SQLCONNSTR_`
76
+
* MySQL: `MYSQLCONNSTR_`
77
+
* SQLAzure: `SQLAZURECONNSTR_`
78
+
* Custom: `CUSTOMCONNSTR_`
79
+
* PostgreSQL: `POSTGRESQLCONNSTR_`
80
+
* Notification Hub: `NOTIFICATIONHUBCONNSTR_`
81
+
* Service Bus: `SERVICEBUSCONNSTR_`
82
+
* Event Hub: `EVENTHUBCONNSTR_`
83
+
* Document DB: `DOCDBCONNSTR_`
84
+
* Redis Cache: `REDISCACHECONNSTR_`
85
+
86
+
For example, a MySQL connection string named *connectionstring1* can be accessed as the environment variable `MYSQLCONNSTR_connectionString1`.
71
87
72
88
## Configure environment variables for custom containers
Copy file name to clipboardExpand all lines: learn-pr/wwl-azure/configure-web-app-settings/includes/3-configure-general-settings.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ A list of the currently available settings:
17
17
***HTTP version**: Set to **2.0** to enable support for HTTPS/2 protocol.
18
18
19
19
> [!NOTE]
20
-
> 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, secure your custom DNS name.
20
+
> Most modern browsers support HTTP/2 protocol over TLS only, while nonencrypted traffic continues to use HTTP/1.1. To ensure that client browsers connect to your app with HTTP/2, secure your custom DNS name.
21
21
22
22
***Web sockets**: For ASP.NET SignalR or socket.io, for example.
0 commit comments