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-add-output-binding-storage-queue-cli.md
+21-29Lines changed: 21 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -121,54 +121,37 @@ Observe that you *don't* need to write any code for authentication, getting a qu
121
121
122
122
## View the message in the Azure Storage queue
123
123
124
-
When your function generates an HTTP response for the web browser, it also calls `msg.set(name)`, which writes a message to an Azure Storage queue named `outqueue`, as specified in the queue binding. You can view the queue in the [Azure portal](../storage/queues/storage-quickstart-queues-portal.md) or in the [Microsoft Azure Storage Explorer](https://storageexplorer.com/). You can also view the queue in the Azure CLI as described in the following steps:
124
+
You can view the queue in the [Azure portal](../storage/queues/storage-quickstart-queues-portal.md) or in the [Microsoft Azure Storage Explorer](https://storageexplorer.com/). You can also view the queue in the Azure CLI, as described in the following steps:
125
125
126
-
1. Open the function project's *local.setting.json* file and copy the connection string value. In a terminal or command window, run the following command to create an environment variable named `AZURE_STORAGE_CONNECTION_STRING`, pasting your specific connection string in place of `<connection_string>`. (This environment variable means you don't need to supply the connection string to each subsequent command using the `--connection-string` argument.)
126
+
1. Open the function project's *local.setting.json* file and copy the connection string value. In a terminal or command window, run the following command to create an environment variable named `AZURE_STORAGE_CONNECTION_STRING`, pasting your specific connection string in place of `<MY_CONNECTION_STRING>`. (This environment variable means you don't need to supply the connection string to each subsequent command using the `--connection-string` argument.)
set AZURE_STORAGE_CONNECTION_STRING="<connection_string>"
143
+
set AZURE_STORAGE_CONNECTION_STRING="<MY_CONNECTION_STRING>"
144
144
```
145
145
146
146
---
147
147
148
148
1. (Optional) Use the [`az storage queue list`](/cli/azure/storage/queue#az-storage-queue-list) command to view the Storage queues in your account. The output from this command should include a queue named `outqueue`, which was created when the function wrote its first message to that queue.
149
149
150
-
# [bash](#tab/bash)
151
-
152
-
```bash
153
-
az storage queue list --output tsv
154
-
```
155
-
156
-
# [PowerShell](#tab/powershell)
157
-
158
-
```powershell
159
-
az storage queue list --output tsv
160
-
```
161
-
162
-
# [Cmd](#tab/cmd)
163
-
164
-
```cmd
150
+
```azure-cli
165
151
az storage queue list --output tsv
166
152
```
167
-
168
-
---
169
153
170
-
171
-
1. Use the [`az storage message peek`](/cli/azure/storage/message#az-storage-message-peek) command to view the messages in this queue, which should be the first name you used when testing the function earlier. The command retrieves the first message in the queue in [base64 encoding](functions-bindings-storage-queue-trigger.md#encoding), so you must also decode the message to view as text.
154
+
1. Use the [`az storage message peek`](/cli/azure/storage/message#az-storage-message-peek) command to view a message in this queue, which should be the first name you used when testing the function earlier. The command retrieves only the first message in the queue, which is [base64 encoded](functions-bindings-storage-queue-trigger.md#encoding), and decodes it to show the message text.
172
155
173
156
# [bash](#tab/bash)
174
157
@@ -184,8 +167,12 @@ When your function generates an HTTP response for the web browser, it also calls
184
167
185
168
# [Cmd](#tab/cmd)
186
169
187
-
Because you need to dereference the message collection and decode from base64, run PowerShell and use the PowerShell command.
170
+
```cmd
171
+
az storage message peek --queue-name outqueue -o tsv --query [].{Message:content} > %TEMP%out.b64 && certutil -decode -f %TEMP%out.b64 %TEMP%out.txt > NUL && type %TEMP%out.txt && del %TEMP%out.b64 %TEMP%out.txt /q
172
+
```
188
173
174
+
This script uses certutil to decode the base64-encoded message collection from a local temp file. If there's no output, try removing `> NUL` from the script and stop suppressing certutil message, in case there's an error.
175
+
189
176
---
190
177
191
178
## Redeploy the project to Azure
@@ -220,9 +207,7 @@ Now that you've tested the function locally and verified that it wrote a message
220
207
221
208
## Clean up resources
222
209
223
-
If you continue to the next step, [Enable Application Insights integration](functions-monitoring.md#manually-connect-an-app-insights-resource), keep all your resources in place as you'll build on what you've already done.
224
-
225
-
Otherwise, use the following command to delete the resource group and all its contained resources to avoid incurring further costs.
210
+
After you've finished, use the following command to delete the resource group and all its contained resources to avoid incurring further costs.
226
211
227
212
```azurecli
228
213
az group delete --name AzureFunctionsQuickstart-rg
@@ -232,27 +217,34 @@ az group delete --name AzureFunctionsQuickstart-rg
232
217
233
218
You've updated your HTTP triggered function to write data to a Storage queue. Now you can learn more about developing Functions from the command line using Core Tools and Azure CLI:
234
219
235
-
+[Work with Azure Functions Core Tools](functions-run-local.md)
220
+
+[Work with Azure Functions Core Tools](functions-run-local.md)
236
221
::: zone pivot="programming-language-csharp"
237
222
+[Examples of complete Function projects in C#](/samples/browse/?products=azure-functions&languages=csharp).
Copy file name to clipboardExpand all lines: includes/functions-run-function-test-local-cli.md
+12-5Lines changed: 12 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ ms.author: glenga
8
8
9
9
## Run the function locally
10
10
11
-
Start the function by starting the local Azure Functions runtime host in the *LocalFunctionProj* folder:
11
+
Run your function by starting the local Azure Functions runtime host from the *LocalFunctionProj* folder:
12
12
13
13
::: zone pivot="programming-language-csharp,programming-language-powershell,programming-language-javascript,programming-language-python"
14
14
```
@@ -23,21 +23,28 @@ npm start
23
23
```
24
24
::: zone-end
25
25
26
-
The following output should appear. (If HttpExample doesn't appear as shown below, you likely started the host from within the *HttpExample* folder. In that case, use **Ctrl**+**C** to stop the host, navigate to the parent *LocalFunctionProj* folder, and run the previous command again.)
26
+
Toward the end of the output, the following lines should appear:
> If HttpExample doesn't appear as shown below, you likely started the host from within the *HttpExample* folder. In that case, use **Ctrl**+**C** to stop the host, navigate to the parent *LocalFunctionProj* folder, and run the previous command again.
36
43
37
44
Copy the URL of your `HttpExample` function from this output to a browser and append the query string `?name=<your-name>`, making the full URL like `http://localhost:7071/api/HttpExample?name=Functions`. The browser should display a message like `Hello Functions`:
38
45
39
46

40
47
41
48
The terminal in which you ran `func start` also shows log output as you make requests.
42
49
43
-
When you're ready, use **Ctrl**+**C** to stop the functions host.
50
+
When you're ready, use **Ctrl**+**C**and choose `y`to stop the functions host.
0 commit comments