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: articles/static-web-apps/apis-overview.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
@@ -42,7 +42,7 @@ The following constraints apply to all API backends:
42
42
43
43
- Each static web app environment can only be configured with one type of backend API at a time.
44
44
- The API route prefix must be `/api`.
45
-
- Route rules for APIs only support [redirects](configuration.md#defining-routes) and [securing routes with roles](configuration.md#securing-routes-with-roles).
45
+
- Route rules for APIs only support [redirects](configuration.md#define-routes) and [securing routes with roles](configuration.md#securing-routes-with-roles).
46
46
- Only HTTP requests are supported for APIs. WebSocket, for example, is not supported.
47
47
- The maximum duration of each API request 45 seconds.
title: Configure application settings for Azure Static Web Apps
3
-
description: Learn to configure application settings for Azure Static Web Apps
3
+
description: Learn how to configure application settings for Azure Static Web Apps.
4
4
services: static-web-apps
5
5
author: burkeholland
6
6
ms.service: static-web-apps
7
7
ms.topic: how-to
8
-
ms.date: 12/21/2021
8
+
ms.date: 01/10/2023
9
9
ms.author: buhollan
10
-
ms.custom: devx-track-js
10
+
ms.custom: devx-track-js, engagement-fy23
11
11
---
12
12
13
13
# Configure application settings for Azure Static Web Apps
14
14
15
-
Application settings hold configuration values that may change, such as database connection strings. Adding application settings allows you to modify the configuration input to your app, without having to change application code.
15
+
When you configure application settings and environment variables, you modify the configuration input to your app without the need to change application code, such as with database connection strings. You can also store secrets used in [authentication configuration](key-vault-secrets.md).
16
16
17
-
Application settings:
18
-
19
-
- Are available as environment variables to the backend API of a static web app
20
-
- Can be used to store secrets used in [authentication configuration](key-vault-secrets.md)
21
-
- Are encrypted at rest
22
-
- Are copied to [staging](review-publish-pull-requests.md) and production environments
23
-
- May only be alphanumeric characters, `.`, and `_`
17
+
Application settings are encrypted at rest, copied to [staging](review-publish-pull-requests.md) and production environments, used by backend APIs, and may only be alphanumeric characters, plus `.` and `_`.
24
18
25
19
> [!IMPORTANT]
26
20
> The application settings described in this article only apply to the backend API of an Azure Static Web App.
@@ -30,11 +24,11 @@ Application settings:
30
24
## Prerequisites
31
25
32
26
- An Azure Static Web Apps application
33
-
-[Azure CLI](/cli/azure/install-azure-cli) — required if you are using the command line
27
+
-[Azure CLI](/cli/azure/install-azure-cli)-required if you are using the command line
34
28
35
29
## Configure API application settings for local development
36
30
37
-
APIs in Azure Static Web Apps are powered by Azure Functions, which allows you to define application settings in the _local.settings.json_ file when you're running the application locally. This file defines application settings in the `Values` property of the configuration.
31
+
APIs in Azure Static Web Apps are powered by Azure Functions, which allows you to define application settings in the _local.settings.json_ file when you run the application locally. This file defines application settings in the `Values` property of the configuration.
38
32
39
33
> [!NOTE]
40
34
> The _local.settings.json_ file is only used for local development. Use the [Azure portal](#configure-application-settings) to configure application settings for production.
@@ -58,41 +52,33 @@ Settings defined in the `Values` property can be referenced from code as environ
The `local.settings.json` file is not tracked by the GitHub repository because sensitive information, like database connection strings, are often included in the file. Since the local settings remain on your machine, you need to manually configure your settings in Azure.
55
+
The `local.settings.json` file isn't tracked by the GitHub repository because sensitive information, like database connection strings, are often included in the file. Since the local settings remain on your machine, you need to manually configure your settings in Azure.
62
56
63
-
Generally, configuring your settings is done infrequently, and isn't required with every build.
57
+
Generally, your settings are infrequently set, so aren't required with every build.
64
58
65
-
## <aname="configure-application-settings"></a>Configure API application settings in Azure
59
+
## Configure application settings
66
60
67
-
You can configure application settings via the Azure portal or with the Azure CLI.
61
+
You can configure application settings via the [Azure portal](https://portal.azure.com) or with the [Azure CLI](#use-the-azure-cli).
68
62
69
63
### Use the Azure portal
70
64
71
65
The Azure portal provides an interface for creating, updating and deleting application settings.
72
66
73
67
1. Go to the [Azure portal](https://portal.azure.com).
74
-
75
68
1. Open your static web app.
76
-
77
69
1. Select **Configuration** in the sidebar.
78
-
79
-
1. Select the environment that you want to apply the application settings to. Staging environments are automatically created when a pull request is generated, and are promoted into production once the pull request is merged. You can set application settings per environment.
80
-
70
+
1. Select the environment to which you want to apply the application settings. You can configure application settings per environment. When you create a pull request, staging environments are automatically created, and then promoted into production when you merge the pull request.
81
71
1. Select **+ Add** to add a new app setting.
82
-
83
-
:::image type="content" source="media/application-settings/configuration.png" alt-text="Azure Static Web Apps configuration view":::
84
-
72
+
:::image type="content" source="media/application-settings/configuration.png" alt-text="Screenshot of Azure Static Web Apps configuration view":::
85
73
1. Enter a **Name** and **Value**.
86
-
87
74
1. Select **OK**.
88
-
89
75
1. Select **Save**.
90
76
91
77
### Use the Azure CLI
92
78
93
-
You can use the `az staticwebapp appsettings` command to update your settings in Azure.
79
+
Use the `az staticwebapp appsettings` command to update your settings in Azure.
94
80
95
-
-In a terminal or command line, execute the following command to add or update a setting named `message` with a value of `Hello world`. Make sure to replace the placeholder `<YOUR_APP_ID>` with your value.
81
+
In a terminal or command line, execute the following command to add or update a setting named `message` with a value of `Hello world`. Make sure to replace the placeholder `<YOUR_APP_ID>` with your value.
96
82
97
83
```azurecli
98
84
az staticwebapp appsettings set --name <YOUR_APP_ID> --setting-names "message=Hello world"
@@ -101,30 +87,32 @@ You can use the `az staticwebapp appsettings` command to update your settings in
101
87
> [!TIP]
102
88
> You can add or update multiple settings by passing multiple name-value pairs to `--setting-names`.
103
89
104
-
### View application settings with the Azure CLI
105
-
106
-
Application settings are available to view through the Azure CLI.
90
+
#### View application settings with the Azure CLI
107
91
108
-
-In a terminal or command line, execute the following command. Make sure to replace the placeholder `<YOUR_APP_ID>` with your value.
92
+
In a terminal or command line, execute the following command. Make sure to replace the placeholder `<YOUR_APP_ID>` with your value.
109
93
110
94
```azurecli
111
95
az staticwebapp appsettings list --name <YOUR_APP_ID>
112
96
```
113
97
114
-
### Delete application settings with the Azure CLI
98
+
####Delete application settings with the Azure CLI
115
99
116
-
Application settings can be deleted through the Azure CLI.
117
-
118
-
- In a terminal or command line, execute the following command to delete a setting named `message`. Make sure to replace the placeholder `<YOUR_APP_ID>` with your value.
100
+
In a terminal or command line, execute the following command to delete a setting named `message`. Make sure to replace the placeholder `<YOUR_APP_ID>` with your value.
119
101
120
102
```azurecli
121
103
az staticwebapp appsettings delete --name <YOUR_APP_ID> --setting-names "message"
122
104
```
123
105
124
106
> [!TIP]
125
-
> You can delete multiple settings by passing multiple setting names to `--setting-names`.
107
+
> Delete multiple settings by passing multiple setting names to `--setting-names`.
Copy file name to clipboardExpand all lines: articles/static-web-apps/build-configuration.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
@@ -228,7 +228,7 @@ If you want to skip building the API, you can bypass the automatic build and dep
228
228
229
229
Steps to skip building the API:
230
230
231
-
- In the *staticwebapp.config.json* file, set `apiRuntime` to the correct runtime and version. Refer to [Configure Azure Static Web Apps](configuration.md#selecting-the-api-language-runtime-version) for the list of supported runtimes and versions.
231
+
- In the *staticwebapp.config.json* file, set `apiRuntime` to the correct runtime and version. Refer to [Configure Azure Static Web Apps](configuration.md#select-the-api-language-runtime-version) for the list of supported runtimes and versions.
0 commit comments