Skip to content

Commit 41ff68f

Browse files
authored
Merge pull request #113208 from dksimpson/release-functions-ux-update-dks-14
Functions update for portal UX refresh - batch 14
2 parents e44d441 + 670049e commit 41ff68f

File tree

6 files changed

+26
-31
lines changed

6 files changed

+26
-31
lines changed

articles/azure-functions/functions-create-cosmos-db-triggered-function.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ description: Use Azure Functions to create a serverless function that is invoked
44

55
ms.assetid: bc497d71-75e7-47b1-babd-a060a664adca
66
ms.topic: how-to
7-
ms.date: 10/02/2018
7+
ms.date: 04/28/2020
88
ms.custom: cc996988-fb4f-47
99
---
1010
# Create a function triggered by Azure Cosmos DB
1111

1212
Learn how to create a function triggered when data is added to or changed in Azure Cosmos DB. To learn more about Azure Cosmos DB, see [Azure Cosmos DB: Serverless database computing using Azure Functions](../cosmos-db/serverless-computing-database.md).
1313

14-
![View message in the logs.](./media/functions-create-cosmos-db-triggered-function/quickstart-completed.png)
14+
:::image type="content" source="./media/functions-create-cosmos-db-triggered-function/quickstart-completed.png" alt-text="Azure Cosmos DB code":::
1515

1616
## Prerequisites
1717

@@ -22,6 +22,9 @@ To complete this tutorial:
2222
> [!NOTE]
2323
> [!INCLUDE [SQL API support only](../../includes/functions-cosmosdb-sqlapi-note.md)]
2424
25+
## Sign in to Azure
26+
Sign in to the [Azure portal](https://portal.azure.com/) with your Azure account.
27+
2528
## Create an Azure Cosmos DB account
2629

2730
You must have an Azure Cosmos DB account that uses the SQL API before you create the trigger.
@@ -38,35 +41,33 @@ Next, you create a function in the new function app.
3841

3942
## Create Azure Cosmos DB trigger
4043

41-
1. Expand your function app and click the **+** button next to **Functions**. If this is the first function in your function app, select **In-portal** then **Continue**. Otherwise, go to step three.
42-
43-
![Functions quickstart page in the Azure portal](./media/functions-create-cosmos-db-triggered-function/function-app-quickstart-choose-portal.png)
44+
1. In your function app, select **Functions** from the left menu, and then select **Add** from the top menu.
4445

45-
1. Choose **More templates** then **Finish and view templates**.
46+
1. On the **New Function** page, enter `cosmos` in the search field and then choose the **Azure Cosmos DB trigger** template.
4647

47-
![Functions quickstart choose more templates](./media/functions-create-cosmos-db-triggered-function/add-first-function.png)
48+
:::image type="content" source="./media/functions-create-cosmos-db-triggered-function/function-choose-cosmos.png" alt-text="Functions page in the Azure portal":::
4849

49-
1. In the search field, type `cosmos` and then choose the **Azure Cosmos DB trigger** template.
5050

51-
1. If prompted, select **Install** to install the Azure Cosmos DB extension in the function app. After installation succeeds, select **Continue**.
51+
1. Configure the new trigger with the settings as specified in the following table:
5252

53-
![Install binding extensions](./media/functions-create-cosmos-db-triggered-function/functions-create-cosmos-db-trigger-portal.png)
53+
| Setting | Suggested value | Description |
54+
| ------------ | ---------------- | ------------------------------------------ |
55+
| **New Function** | Accept the default name | The name of the function. |
56+
| **Cosmos DB account connection** | Accept the default new name | Select **New**, the **Database Account** you created earlier, and then **OK**. This action creates an application setting for your account connection. This setting is used by the binding to connection to the database. |
57+
| **Database name** | Tasks | Name of the database that includes the collection to be monitored. |
58+
| **Collection name** | Items | Name of the collection to be monitored. |
59+
| **Collection name for leases** | leases | Name of the collection to store the leases. |
60+
| **Create lease collection if it does not exist** | Yes | Checks for existence of the lease collection and automatically creates it. |
5461

55-
1. Configure the new trigger with the settings as specified in the table below the image.
62+
:::image type="content" source="./media/functions-create-cosmos-db-triggered-function/functions-cosmosdb-trigger-settings.png" alt-text="Create the Azure Cosmos DB triggered function":::
5663

57-
![Create the Azure Cosmos DB triggered function](./media/functions-create-cosmos-db-triggered-function/functions-cosmosdb-trigger-settings.png)
64+
1. Select **Create Function**.
5865

59-
| Setting | Suggested value | Description |
60-
| ------------ | ---------------- | ------------------------------------------ |
61-
| **Name** | Default | Use the default function name suggested by the template.|
62-
| **Azure Cosmos DB account connection** | New setting | Select **New**, then choose your **Subscription**, the **Database account** you created earlier, and **Select**. This creates an application setting for your account connection. This setting is used by the binding to connection to the database. |
63-
| **Container name** | Items | Name of container to be monitored. |
64-
| **Create lease container if it doesn't exist** | Checked | The container doesn't already exist, so create it. |
65-
| **Database name** | Tasks | Name of database with the container to be monitored. |
66+
Azure creates the Cosmos DB trigger function.
6667

67-
1. Click **Create** to create your Azure Cosmos DB triggered function. After the function is created, the template-based function code is displayed.
68+
1. To display the template-based function code, select **Code + Test**.
6869

69-
![Cosmos DB function template in C#](./media/functions-create-cosmos-db-triggered-function/function-cosmosdb-template.png)
70+
:::image type="content" source="./media/functions-create-cosmos-db-triggered-function/function-cosmosdb-template.png" alt-text="Cosmos DB function template in C#":::
7071

7172
This function template writes the number of documents and the first document ID to the logs.
7273

@@ -105,7 +106,7 @@ After the container specified in the function binding exists, you can test the f
105106

106107
1. Expand the new **Items** container in Data Explorer, choose **Items**, then select **New Item**.
107108

108-
![Create an item in Items container](./media/functions-create-cosmos-db-triggered-function/create-item-in-container.png)
109+
:::image type="content" source="./media/functions-create-cosmos-db-triggered-function/create-item-in-container.png" alt-text="Create an item in Items container":::
109110

110111
1. Replace the contents of the new item with the following content, then choose **Save**.
111112

38.9 KB
Loading
-32.1 KB
Loading
Loading
-56.7 KB
Loading

includes/cosmos-db-create-dbaccount.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,11 @@
1010
ms.custom: include file
1111
---
1212

13-
1. Go to the [Azure portal](https://portal.azure.com/) to create an Azure Cosmos DB account. At your homepage choose **Create a resource** from the **Azure services** panel.
13+
1. From the Azure portal menu or the **Home page**, select **Create a resource**.
1414

15-
![Create a resource](./media/cosmos-db-create-dbaccount/azure-cosmos-db-create-resource-1.png)
15+
1. On the **New** page, search for and select **Azure Cosmos DB**.
1616

17-
1. Search for and select **Azure Cosmos DB**.
18-
19-
![The Azure portal resources drop-down](./media/cosmos-db-create-dbaccount/create-nosql-db-databases-json-tutorial-updated-1.png)
20-
21-
1. Select **Create**.
22-
23-
![Create Azure Cosmos DB resource](./media/cosmos-db-create-dbaccount/azure-cosmos-db-create-account-1.png)
17+
1. On the **Azure Cosmos DB** page, select **Create**.
2418

2519
1. On the **Create Azure Cosmos DB Account** page, enter the basic settings for the new Azure Cosmos account.
2620

0 commit comments

Comments
 (0)