Skip to content

Commit 490d619

Browse files
Merge pull request #112744 from damabe/1697055-damabe10
Update article Azure Function portal UX refresh: User Story 1697055, Part 10
2 parents 8d3d9b5 + d7ddda6 commit 490d619

7 files changed

+28
-50
lines changed

articles/azure-functions/functions-integrate-storage-queue-output-binding.md

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

55
ms.assetid: 0b609bc0-c264-4092-8e3e-0784dcc23b5d
66
ms.topic: how-to
7-
ms.date: 09/19/2017
7+
ms.date: 04/24/2020
88
ms.custom: mvc
99
---
1010
# Add messages to an Azure Storage queue using Functions
1111

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-
![Queue message shown in Storage Explorer](./media/functions-integrate-storage-queue-output-binding/function-queue-storage-output-view-queue.png)
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.
1513

1614
## Prerequisites
1715

1816
To complete this quickstart:
1917

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

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

2422
## <a name="add-binding"></a>Add an output binding
2523

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

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

34-
1. Click **Select**.
28+
1. Select your function app, and then select the function that you created in that earlier quickstart.
3529

36-
![Add a Queue storage output binding to a function in the Azure portal.](./media/functions-integrate-storage-queue-output-binding/function-add-queue-storage-output-binding.png)
30+
1. Select **Integration**, and then select **+ Add output**.
3731

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":::
3933

40-
![Install the Storage binding extension](./media/functions-integrate-storage-queue-output-binding/functions-integrate-install-binding-extension.png)
41-
42-
1. Under **Azure Queue Storage output**, use the settings as specified in the table that follows this screenshot:
43-
44-
![Add a Queue storage output binding to a function in the Azure portal.](./media/functions-integrate-storage-queue-output-binding/function-add-queue-storage-output-binding-2.png)
34+
1. Select the **Azure Queue Storage** binding type, and add the settings as specified in the table that follows this screenshot:
4535

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":::
37+
4638
| Setting | Suggested value | Description |
4739
| ------------ | ------- | -------------------------------------------------- |
4840
| **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. |
4942
| **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. |
5143

52-
1. Click **Save** to add the binding.
44+
1. Select **OK** to add the binding.
5345

5446
Now that you have an output binding defined, you need to update the code to use the binding to add messages to a queue.
5547

5648
## Add code that uses the output binding
5749

5850
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*.
5951

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

6254
1. Update the function code depending on your function language:
6355

@@ -94,54 +86,40 @@ In this section, you add code that writes a message to the output queue. The mes
9486

9587
## Test the function
9688

97-
1. After the code changes are saved, select **Run**.
89+
1. After the code changes are saved, select **Test**.
90+
1. Confirm that your test matches the image below and select **Run**.
9891

99-
![Add a Queue storage output binding to a function in the Azure portal.](./media/functions-integrate-storage-queue-output-binding/functions-test-run-function.png)
92+
:::image type="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":::
10093

10194
Notice that the **Request body** contains the `name` value *Azure*. This value appears in the queue message that is created when the function is invoked.
10295

10396
As an alternative to selecting **Run** here, you can call the function by entering a URL in a browser and specifying the `name` value in the query string. The browser method is shown in the [previous quickstart](functions-create-first-azure-function.md#test-the-function).
10497

105-
2. Check the logs to make sure that the function succeeded.
98+
1. Check the logs to make sure that the function succeeded.
10699

107-
A new queue named **outqueue** is created in your Storage account by the Functions runtime 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+
A new queue named **outqueue** is created in your Storage account by the Functions runtime when the output binding is first used. You'll use storage account to verify that the queue and a message in it were created.
108101

109-
### Connect Storage Explorer to your account
102+
### Find the storage account connected to AzureWebJobsStorage
110103

111-
Skip this section if you have already installed Storage Explorer and connected it to the storage account that you're using with this quickstart.
112104

113-
1. Run the [Microsoft Azure Storage Explorer](https://storageexplorer.com/) tool, select the connect icon on the left, choose **Use a storage account name and key**, and select **Next**.
105+
1. Go to your function app and select **Configuration**.
114106

115-
![Run the Storage Account Explorer tool.](./media/functions-integrate-storage-queue-output-binding/functions-storage-manager-connect-1.png)
107+
1. Under **Application settings**, select **AzureWebJobsStorage**.
116108

117-
1. In the Azure portal, on the function app page, select your function and then select **Integrate**.
109+
:::image type="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":::
118110

119-
1. Select the **Azure Queue storage** output binding that you added in an earlier step.
111+
1. Locate and make note of the account name.
120112

121-
1. Expand the **Documentation** section at the bottom of the page.
122-
123-
The portal shows credentials that you can use in Storage Explorer to connect to the storage account.
124-
125-
![Get the Storage account connection credentials.](./media/functions-integrate-storage-queue-output-binding/function-get-storage-account-credentials.png)
126-
127-
1. Copy the **Account Name** value from the portal and paste it in the **Account name** box in Storage Explorer.
128-
129-
1. Click the show/hide icon next to **Account Key** to display the value, and then copy the **Account Key** value and paste it in the **Account key** box in Storage Explorer.
130-
131-
1. Select **Next > Connect**.
132-
133-
![Paste the storage credentials and connect.](./media/functions-integrate-storage-queue-output-binding/functions-storage-manager-connect-2.png)
113+
:::image type="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":::
134114

135115
### Examine the output queue
136116

137-
1. In Storage Explorer, select the storage account that you're using for this quickstart.
117+
1. In the resource group for your function app, select the storage account that you're using for this quickstart.
138118

139-
1. Expand the **Queues** node, and then select the queue named **outqueue**.
119+
1. Under **Queue service**, select **Queues** and select the queue named **outqueue**.
140120

141121
The queue contains the message that the queue output binding created when you ran the HTTP-triggered function. If you invoked the function with the default `name` value of *Azure*, the queue message is *Name passed to the function: Azure*.
142122

143-
![Queue message shown in Storage Explorer](./media/functions-integrate-storage-queue-output-binding/function-queue-storage-output-view-queue.png)
144-
145123
1. Run the function again, and you'll see a new message appear in the queue.
146124

147125
## Clean up resources
Loading
Loading
Loading
17.7 KB
Loading
12.3 KB
Loading

0 commit comments

Comments
 (0)