Skip to content

Commit 24a2120

Browse files
Merge pull request #186879 from DavidCBerry13/nodejs-mongodb
Publish new style nodejs/mongodb article to app service documentation
2 parents a6245d0 + df3433e commit 24a2120

File tree

202 files changed

+1323
-481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+1323
-481
lines changed

.openpublishing.publish.config.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,13 @@
800800
"url": "https://github.com/Azure-Samples/msdocs-python-django-webapp-quickstart",
801801
"branch": "main",
802802
"branch_mapping": {}
803-
}
803+
},
804+
{
805+
"path_to_root": "msdocs-nodejs-mongodb-azure-sample-app",
806+
"url": "https://github.com/Azure-Samples/msdocs-nodejs-mongodb-azure-sample-app",
807+
"branch": "main",
808+
"branch_mapping": {}
809+
}
804810
],
805811
"branch_target_mapping": {
806812
"live": [
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
author: DavidCBerry13
3+
ms.author: daberry
4+
ms.topic: include
5+
ms.date: 01/30/2022
6+
---
7+
On the page for the web app in the Azure portal:
8+
9+
1. Select **Configuration** under the *Settings* header in the left toolbar to bring up the Application settings.
10+
1. Select **New application setting** under **Application settings**.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
author: DavidCBerry13
3+
ms.author: daberry
4+
ms.topic: include
5+
ms.date: 01/30/2022
6+
---
7+
Using the dialog, enter a new setting with:<br>
8+
<br>
9+
*Name* &rarr; **SCM_DO_BUILD_DURING_DEPLOYMENT**<br>
10+
*Value* &rarr; **true**<br>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
author: DavidCBerry13
3+
ms.author: daberry
4+
ms.topic: include
5+
ms.date: 01/30/2022
6+
---
7+
Navigate to your Cosmos DB account. If you have just created your Cosmos DB account, you can select the *Go to resource* button to be taken directly to the account. Or you can use the search box at the top of the screen to search for and navigate to your Cosmos DB database.
8+
9+
1. On the page for your Cosmos DB, make sure the Quick start item is selected in the left menu. You will see text box labeled **Primary Connection String**. While there are tabs for different languages, the connection string is the same regardless of language.
10+
2. Copy the value of the connection string into your clipboard buffer.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
author: DavidCBerry13
3+
ms.author: daberry
4+
ms.topic: include
5+
ms.date: 01/30/2022
6+
---
7+
Navigate back to your App Service instance to set the connection string for your web app.<br>
8+
<br>
9+
1. In the search box at the top of the screen, type the name of your App Service (*msdocs-expressjs-mongodb-XYZ*).
10+
1. Select your App Service when it appears under the *Resources* section of the dialog to go to the App Service.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
author: DavidCBerry13
3+
ms.author: daberry
4+
ms.topic: include
5+
ms.date: 01/30/2022
6+
---
7+
On the page for the App Service:
8+
1. Select the **Configuration** item under *Settings*.
9+
1. In the **Application settings** section (not the Connection strings section), select the *+ New application setting* menu item to add a setting.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
author: DavidCBerry13
3+
ms.author: daberry
4+
ms.topic: include
5+
ms.date: 01/30/2022
6+
---
7+
In the *Add/Edit application setting* dialog, set the *Name* of the setting to **DATABASE_URL** to match the name used in the application code. Then paste the connection string value for your database into the *Value* field.
8+
9+
Select *OK* to save this setting.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
author: DavidCBerry13
3+
ms.author: daberry
4+
ms.topic: include
5+
ms.date: 01/30/2022
6+
---
7+
To get the connection string for a Cosmos DB database, use the [az cosmos keys list](/cli/azure/cosmosdb/keys) command.
8+
9+
#### [bash](#tab/terminal-bash)
10+
11+
```azurecli
12+
az cosmosdb keys list \
13+
--type connection-strings \
14+
--resource-group $RESOURCE_GROUP_NAME \
15+
--name $COSMOS_DB_NAME \
16+
--query "connectionStrings[?description=='Primary MongoDB Connection String'].connectionString" \
17+
--output tsv
18+
```
19+
20+
#### [PowerShell terminal](#tab/terminal-powershell)
21+
22+
```azurecli
23+
az cosmosdb keys list `
24+
--type connection-strings `
25+
--resource-group $resourceGroupName `
26+
--name $cosmosDbName `
27+
--query "connectionStrings[?description=='Primary MongoDB Connection String'].connectionString" `
28+
--output tsv
29+
```
30+
31+
---
32+
33+
Rather than copying and pasting the value, the connection string can be stored in a variable to make the next step easier.
34+
35+
#### [bash](#tab/terminal-bash)
36+
37+
```azurecli
38+
COSMOS_DB_CONNECTION_STRING=`az cosmosdb keys list \
39+
--type connection-strings \
40+
--resource-group $RESOURCE_GROUP_NAME \
41+
--name $COSMOS_DB_NAME \
42+
--query "connectionStrings[?description=='Primary MongoDB Connection String'].connectionString" \
43+
--output tsv
44+
```
45+
46+
#### [PowerShell terminal](#tab/terminal-powershell)
47+
48+
```azurecli
49+
$cosmosDbConnectionString = az cosmosdb keys list `
50+
--type connection-strings `
51+
--resource-group $resourceGroupName `
52+
--name $cosmosDbName `
53+
--query "connectionStrings[?description=='Primary MongoDB Connection String'].connectionString" `
54+
--output tsv
55+
```
56+
57+
---
58+
59+
The [az webapp config appsettings](/cli/azure/webapp/config/appsettings) command is used to set application setting values for an App Service web app. One or more key-value pairs are set using the `--settings` parameter. To set the `DATABASE_URL` value to the connection string for your web app, use the following command.
60+
61+
#### [bash](#tab/terminal-bash)
62+
63+
```azurecli
64+
az webapp config appsettings set \
65+
--name $APP_SERVICE_NAME \
66+
--resource-group $RESOURCE_GROUP_NAME \
67+
--settings DATABASE_URL=$COSMOS_DB_CONNECTION_STRING
68+
```
69+
70+
#### [PowerShell terminal](#tab/terminal-powershell)
71+
72+
```azurecli
73+
az webapp config appsettings set `
74+
--name $appServiceName `
75+
--resource-group $resourceGroupName `
76+
--settings DATABASE_URL=$cosmosDbConnectionString
77+
```
78+
79+
---
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
author: DavidCBerry13
3+
ms.author: daberry
4+
ms.topic: include
5+
ms.date: 01/30/2022
6+
---
7+
In the *Databases* section of the Azure Tools extension for VS Code:
8+
9+
1. Locate the database for your application and right-click on your database.
10+
1. Select *Copy Connection String* from the context menu to copy the connection string to your clipboard.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
author: DavidCBerry13
3+
ms.author: daberry
4+
ms.topic: include
5+
ms.date: 01/30/2022
6+
---
7+
Locate the *App Service* section of the Azure Tools for VS Code extension.
8+
9+
1. Find your application and select the caret symbol (>) to expand the properties of the application.
10+
1. Right-click on the *Application Settings* item and select *Add New Setting...* from the context menu.

0 commit comments

Comments
 (0)