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-apps/environment-variables.md
+15-16Lines changed: 15 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Configure application settings for Azure Static Web Apps
2
+
title: Configure environment variables for Azure Static Web Apps
3
3
description: #Required; article description that is displayed in search results.
4
4
services: static-web-apps
5
5
author: burkeholland
@@ -9,24 +9,22 @@ ms.date: 05/08/2020
9
9
ms.author: buhollan
10
10
---
11
11
12
-
# Configure application settings for Azure Static Web Apps
12
+
# Configure environment variables for Azure Static Web Apps
13
13
14
-
Application settings hold configuration settings for values that may change, such as database connection strings. Adding application settings allow you to modify the configuration input to your app, without having to change application code.
14
+
Environment variables hold configuration settings for values that may change, such as database connection strings. Adding environment variables allows you to modify the configuration input to your app, without having to change application code.
15
15
16
-
Application settings are also sometimes referred to as environment variables.
16
+
Environment variables are also sometimes referred to as application settings.
-[Node.js and npm](https://nodejs.org/en/download/), the Node.js package manager.
23
-
- This requirement is used only to run the simple upload solution. It is not needed if the Azure CLI `rest` command is used to sync application settings to Azure.
24
22
25
-
## Types of application settings
23
+
## Types of environment variables
26
24
27
25
There are typically two aspects to an Azure Static Web Apps application. The first is the web application, or static content, which is represented by HTML, CSS, JavaScript, and images. The second is the back-end API, which is powered by an Azure Functions application.
28
26
29
-
This article demonstrates how to manage application settings for the back-end API in Azure Functions.
27
+
This article demonstrates how to manage environment variables for the back-end API in Azure Functions.
30
28
31
29
Many front-end frameworks and static site generators allow the use of environment variables during development. At build time, these variables are replaced by their values in the generated HTML or JavaScript. Since data in HTML and JavaScript is easily discoverable by site visitor, you want to avoid putting sensitive information in the front-end application. Settings that hold sensitive data are best located in API app.
32
30
@@ -45,11 +43,11 @@ For more information about how to use environment variables with your JavaScript
APIs in Azure Static Web Apps are powered by Azure Functions, which allows you to define application settings in the _local.settings.json_ file. This file defines application settings in the `Values` property of the configuration.
48
+
APIs in Azure Static Web Apps are powered by Azure Functions, which allows you to define environment variables in the _local.settings.json_ file. This file defines environment variables in the `Values` property of the configuration.
51
49
52
-
The following sample _local.settings.json_ shows how to add an application setting for the `DATABASE_CONNECTION_STRING`.
50
+
The following sample _local.settings.json_ shows how to add a value for the `DATABASE_CONNECTION_STRING`.
53
51
54
52
```json
55
53
{
@@ -96,7 +94,7 @@ The Azure Portal provides an interface for creating, updating and deleting App S
96
94
97
95
### Using the Azure CLI
98
96
99
-
You can use the `az rest` command to upload your settings to Azure. The command accepts application settings as JSON objects in a parent property called `properties`.
97
+
You can use the `az rest` command to do bulk uploads of your settings to Azure. The command accepts environment variables as JSON objects in a parent property called `properties`.
100
98
101
99
The easiest way to create a JSON file with the appropriate values is to create a modified version of your _local.settings.json_ file.
102
100
@@ -108,7 +106,7 @@ The easiest way to create a JSON file with the appropriate values is to create a
108
106
109
107
2. Next, make a copy of your _local.settings.json_ file and name it _local.settings.properties.json_.
110
108
111
-
3. Inside the new file, remove all other data from the file except for the application settings and rename `Values` to `properties`.
109
+
3. Inside the new file, remove all other data from the file except for the environment variables and rename `Values` to `properties`.
112
110
113
111
Your file should now look similar to the following example:
114
112
@@ -137,9 +135,9 @@ The Azure CLI command requires a number of values specific to your account to ru
137
135
> [!IMPORTANT]
138
136
> The "local.settings.properties.json" file must be in the same directory where this command is run. This file can be named anything you like. The name is not significant.
139
137
140
-
### Viewing app settings with the Azure CLI
138
+
### View environment variables with the Azure CLI
141
139
142
-
Application settings are available to view through the Azure CLI.
140
+
Environment variables are available to view through the Azure CLI.
143
141
144
142
1. From a terminal or command line, execute the following command. Make sure to replace the placeholders `<YOUR_SUBSCRIPTION_ID>`, `<YOUR_RESOURCE_GROUP_NAME>`, `<YOUR_STATIC_SITE_NAME>` with your values.
145
143
@@ -149,4 +147,5 @@ Application settings are available to view through the Azure CLI.
149
147
150
148
## Next steps
151
149
152
-
> [!div class="nextstepaction"][setup local development for azure static web apps](local-development.md)
0 commit comments