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
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -151,33 +151,35 @@ You can view the queue in the [Azure portal](../storage/queues/storage-quickstar
151
151
az storage queue list --output tsv
152
152
```
153
153
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.
154
+
1. Use the [`az storage message get`](/cli/azure/storage/message#az-storage-message-peek) command to read the message from this queue, which should be the first name you used when testing the function earlier. The command reads and removes the first message from the queue.
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($(az storage message get --queue-name outqueue -o tsv --query '[].{Message:content}')))
166
166
```
167
167
168
168
# [Cmd](#tab/cmd)
169
169
170
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
171
+
az storage message get --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
172
```
173
173
174
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 to stop suppressing certutil output, in case there's an error.
175
175
176
176
---
177
177
178
+
Because the message body is stored [base64 encoded](functions-bindings-storage-queue-trigger.md#encoding), the message must be decoded before it's displayed. After you execute `az storage message get`, the message is removed from the queue. If there was only one message in `outqueue`, you won't retrieve a message when you run this command a second time and instead get an error.
179
+
178
180
## Redeploy the project to Azure
179
181
180
-
Now that you've tested the function locally and verified that it wrote a message to the Azure Storage queue, you can redeploy your project to update the endpoint running on Azure.
182
+
Now that you've verified locally that the function wrote a message to the Azure Storage queue, you can redeploy your project to update the endpoint running on Azure.
181
183
182
184
1. In the *LocalFunctionsProj* folder, use the [`func azure functionapp publish`](functions-run-local.md#project-file-deployment) command to redeploy the project, replacing`<APP_NAME>` with the name of your app.
183
185
@@ -203,8 +205,6 @@ Now that you've tested the function locally and verified that it wrote a message
203
205
204
206
1. Examine the Storage queue again, as described in the previous section, to verify that it contains the new message written to the queue.
205
207
206
-
If you're using the Azure CLI to examine the queue, the `az storage message peek` command shows only the first message in the queue. To simulate processing the messages, use `az storage message get` instead with all the same arguments. The `get` command returns the message and removes it from the queue. You can then repeat the same command until the queue is empty (and the command gives an error).
207
-
208
208
## Clean up resources
209
209
210
210
After you've finished, use the following command to delete the resource group and all its contained resources to avoid incurring further costs.
@@ -218,6 +218,7 @@ az group delete --name AzureFunctionsQuickstart-rg
218
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:
219
219
220
220
+[Work with Azure Functions Core Tools](functions-run-local.md)
221
+
221
222
::: zone pivot="programming-language-csharp"
222
223
+[Examples of complete Function projects in C#](/samples/browse/?products=azure-functions&languages=csharp).
223
224
@@ -243,8 +244,8 @@ You've updated your HTTP triggered function to write data to a Storage queue. No
0 commit comments