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/azure-functions/functions-integrate-storage-queue-output-binding.md
+28-50Lines changed: 28 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,60 +4,52 @@ description: Use Azure Functions to create a serverless function that is invoked
4
4
5
5
ms.assetid: 0b609bc0-c264-4092-8e3e-0784dcc23b5d
6
6
ms.topic: how-to
7
-
ms.date: 09/19/2017
7
+
ms.date: 04/24/2020
8
8
ms.custom: mvc
9
9
---
10
10
# Add messages to an Azure Storage queue using Functions
11
11
12
-
In Azure Functions, input and output bindings provide a declarative way to make data from external services available to your code. In this quickstart, you use an output binding to create a message in a queue when a function is triggered by an HTTP request. You use Azure Storage Explorer to view the queue messages that your function creates:
13
-
14
-

12
+
In Azure Functions, input and output bindings provide a declarative way to make data from external services available to your code. In this quickstart, you use an output binding to create a message in a queue when a function is triggered by an HTTP request. You use Azure storage container to view the queue messages that your function creates.
15
13
16
14
## Prerequisites
17
15
18
16
To complete this quickstart:
19
17
20
-
* Follow the directions in [Create your first function from the Azure portal](functions-create-first-azure-function.md) and don't do the **Clean up resources** step. That quickstart creates the function app and function that you use here.
18
+
- An Azure subscription. If you don't have one, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
21
19
22
-
* Install [Microsoft Azure Storage Explorer](https://storageexplorer.com/). This is a tool you'll use to examine queue messages that your output binding creates.
20
+
- Follow the directions in [Create your first function from the Azure portal](functions-create-first-azure-function.md) and don't do the **Clean up resources** step. That quickstart creates the function app and function that you use here.
23
21
24
22
## <aname="add-binding"></a>Add an output binding
25
23
26
-
In this section, you use the portal UI to add a queue storage output binding to the function you created earlier. This binding will make it possible to write minimal code to create a message in a queue. You don't have to write code for tasks such as opening a storage connection, creating a queue, or getting a reference to a queue. The Azure Functions runtime and queue output binding take care of those tasks for you.
27
-
28
-
1. In the Azure portal, open the function app page for the function app that you created in [Create your first function from the Azure portal](functions-create-first-azure-function.md). To do this, select **All services > Function Apps**, and then select your function app.
29
-
30
-
1. Select the function that you created in that earlier quickstart.
24
+
In this section, you use the portal UI to add a queue storage output binding to the function you created earlier. This binding makes it possible to write minimal code to create a message in a queue. You don't have to write code for tasks such as opening a storage connection, creating a queue, or getting a reference to a queue. The Azure Functions runtime and queue output binding take care of those tasks for you.
31
25
32
-
1.Select **Integrate > New Output > Azure Queue Storage**.
26
+
1.In the Azure portal, open the function app page for the function app that you created in [Create your first function from the Azure portal](functions-create-first-azure-function.md). To do open the page, search for and select **Function App**. Then, select your function app.
33
27
34
-
1.Click **Select**.
28
+
1. Select your function app, and then select the function that you created in that earlier quickstart.
35
29
36
-

30
+
1. Select **Integration**, and then select **+ Add output**.
37
31
38
-
1. If you get an **Extensions not installed** message, choose **Install** to install the Storage bindings extension in the function app. This may take a minute or two.
32
+
:::image type="content" source="./media/functions-integrate-storage-queue-output-binding/function-create-output-binding.png" alt-text="Create an output binding for your function." border="true":::
39
33
40
-

41
-
42
-
1. Under **Azure Queue Storage output**, use the settings as specified in the table that follows this screenshot:
43
-
44
-

34
+
1. Select the **Azure Queue Storage** binding type, and add the settings as specified in the table that follows this screenshot:
45
35
36
+
:::image type="content" source="./media/functions-integrate-storage-queue-output-binding/function-create-output-binding-details.png" alt-text="Add a Queue storage output binding to a function in the Azure portal." border="true":::
|**Message parameter name**| outputQueueItem | The name of the output binding parameter. |
41
+
|**Queue name**| outqueue | The name of the queue to connect to in your Storage account. |
49
42
|**Storage account connection**| AzureWebJobsStorage | You can use the storage account connection already being used by your function app, or create a new one. |
50
-
|**Queue name**| outqueue | The name of the queue to connect to in your Storage account. |
51
43
52
-
1.Click**Save** to add the binding.
44
+
1.Select**OK** to add the binding.
53
45
54
46
Now that you have an output binding defined, you need to update the code to use the binding to add messages to a queue.
55
47
56
48
## Add code that uses the output binding
57
49
58
50
In this section, you add code that writes a message to the output queue. The message includes the value that is passed to the HTTP trigger in the query string. For example, if the query string includes `name=Azure`, the queue message will be *Name passed to the function: Azure*.
59
51
60
-
1.Select your function to display the function code in the editor.
52
+
1.In your function, select **Code + Test** to display the function code in the editor.
61
53
62
54
1. Update the function code depending on your function language:
63
55
@@ -94,54 +86,40 @@ In this section, you add code that writes a message to the output queue. The mes
:::imagetype="content"source="./media/functions-integrate-storage-queue-output-binding/functions-test-run-function.png"alt-text="Test the queue storage binding in the Azure portal."border="true":::
100
93
101
94
Noticethatthe**Requestbody**containsthe `name` value*Azure*. Thisvalueappearsinthequeuemessagethatiscreated when the function is invoked.
Anewqueuenamed**outqueue**iscreatedinyourStorageaccountbytheFunctionsruntime when the output binding is first used. You'll use Storage Explorer to verify that the queue and a message in it were created.
100
+
Anewqueuenamed**outqueue**iscreatedinyourStorageaccountbytheFunctionsruntime when the output binding is first used. You'll use storage account to verify that the queue and a message in it were created.
108
101
109
-
### Connect Storage Explorer to your account
102
+
### Find the storage account connected to AzureWebJobsStorage
1. Runthe [MicrosoftAzureStorageExplorer](https://storageexplorer.com/) tool, select the connect icon on the left, choose **Use a storage account name and key**, and select **Next**.
:::imagetype="content"source="./media/functions-integrate-storage-queue-output-binding/function-find-storage-account.png"alt-text="Locate the storage account connected to AzureWebJobsStorage."border="true":::
:::imagetype="content"source="./media/functions-integrate-storage-queue-output-binding/function-storage-account-name.png"alt-text="Locate the storage account connected to AzureWebJobsStorage."border="true":::
134
114
135
115
### Examine the output queue
136
116
137
-
1. InStorageExplorer, selectthestorageaccountthatyou're using for this quickstart.
117
+
1. Intheresourcegroupforyourfunctionapp, selectthestorageaccountthatyou're using for this quickstart.
0 commit comments