Skip to content

Commit 9df5a67

Browse files
authored
Merge pull request #223570 from chcomley/users/chcomley/swa-28740-application-settings
Refresh SWA application-settings.md
2 parents b863124 + 9c5229a commit 9df5a67

File tree

4 files changed

+66
-72
lines changed

4 files changed

+66
-72
lines changed

articles/static-web-apps/apis-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The following constraints apply to all API backends:
4242

4343
- Each static web app environment can only be configured with one type of backend API at a time.
4444
- 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).
4646
- Only HTTP requests are supported for APIs. WebSocket, for example, is not supported.
4747
- The maximum duration of each API request 45 seconds.
4848
- Network isolated backends are not supported.
Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
---
22
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.
44
services: static-web-apps
55
author: burkeholland
66
ms.service: static-web-apps
77
ms.topic: how-to
8-
ms.date: 12/21/2021
8+
ms.date: 01/10/2023
99
ms.author: buhollan
10-
ms.custom: devx-track-js
10+
ms.custom: devx-track-js, engagement-fy23
1111
---
1212

1313
# Configure application settings for Azure Static Web Apps
1414

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).
1616

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 `_`.
2418

2519
> [!IMPORTANT]
2620
> 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:
3024
## Prerequisites
3125

3226
- 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
3428

3529
## Configure API application settings for local development
3630

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.
3832

3933
> [!NOTE]
4034
> 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
5852
const connectionString = process.env.DATABASE_CONNECTION_STRING;
5953
```
6054

61-
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.
6256

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.
6458

65-
## <a name="configure-application-settings"></a>Configure API application settings in Azure
59+
## Configure application settings
6660

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).
6862

6963
### Use the Azure portal
7064

7165
The Azure portal provides an interface for creating, updating and deleting application settings.
7266

7367
1. Go to the [Azure portal](https://portal.azure.com).
74-
7568
1. Open your static web app.
76-
7769
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.
8171
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":::
8573
1. Enter a **Name** and **Value**.
86-
8774
1. Select **OK**.
88-
8975
1. Select **Save**.
9076

9177
### Use the Azure CLI
9278

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.
9480

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.
9682

9783
```azurecli
9884
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
10187
> [!TIP]
10288
> You can add or update multiple settings by passing multiple name-value pairs to `--setting-names`.
10389
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
10791

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.
10993

11094
```azurecli
11195
az staticwebapp appsettings list --name <YOUR_APP_ID>
11296
```
11397

114-
### Delete application settings with the Azure CLI
98+
#### Delete application settings with the Azure CLI
11599

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.
119101

120102
```azurecli
121103
az staticwebapp appsettings delete --name <YOUR_APP_ID> --setting-names "message"
122104
```
123105

124106
> [!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`.
126108
127109
## Next steps
128110

129111
> [!div class="nextstepaction"]
130-
> [Configure front-end frameworks](front-end-frameworks.md)
112+
> [Define configuration for Azure Static Web Apps in the _staticwebapp.config.json_ file](configuration.md)
113+
114+
## Related articles
115+
116+
- [Override defaults with custom registration](authentication-custom.md)
117+
- [Define settings that control the build process](./build-configuration.md)
118+
- [API overview](apis-overview.md)

articles/static-web-apps/build-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ If you want to skip building the API, you can bypass the automatic build and dep
228228

229229
Steps to skip building the API:
230230

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.
232232
```json
233233
{
234234
"platform": {

0 commit comments

Comments
 (0)