Skip to content

Commit 897e58e

Browse files
author
Glenn Gailey
committed
Final fixes
1 parent 10ba36a commit 897e58e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

articles/azure-functions/functions-add-output-binding-storage-queue-cli.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,33 +151,35 @@ You can view the queue in the [Azure portal](../storage/queues/storage-quickstar
151151
az storage queue list --output tsv
152152
```
153153
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.
155155
156156
# [bash](#tab/bash)
157157
158158
```bash
159-
echo `echo $(az storage message peek --queue-name outqueue -o tsv --query '[].{Message:content}') | base64 --decode`
159+
echo `echo $(az storage message get --queue-name outqueue -o tsv --query '[].{Message:content}') | base64 --decode`
160160
```
161161
162162
# [PowerShell](#tab/powershell)
163163
164164
```powershell
165-
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($(az storage message peek --queue-name outqueue -o tsv --query '[].{Message:content}')))
165+
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($(az storage message get --queue-name outqueue -o tsv --query '[].{Message:content}')))
166166
```
167167
168168
# [Cmd](#tab/cmd)
169169
170170
```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
172172
```
173173
174174
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.
175175
176176
---
177177
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+
178180
## Redeploy the project to Azure
179181
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.
181183
182184
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.
183185
@@ -203,8 +205,6 @@ Now that you've tested the function locally and verified that it wrote a message
203205
204206
1. Examine the Storage queue again, as described in the previous section, to verify that it contains the new message written to the queue.
205207
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-
208208
## Clean up resources
209209
210210
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
218218
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:
219219

220220
+ [Work with Azure Functions Core Tools](functions-run-local.md)
221+
221222
::: zone pivot="programming-language-csharp"
222223
+ [Examples of complete Function projects in C#](/samples/browse/?products=azure-functions&languages=csharp).
223224

@@ -243,8 +244,8 @@ You've updated your HTTP triggered function to write data to a Storage queue. No
243244

244245
+ [Azure Functions PowerShell developer guide](functions-reference-powershell.md)
245246
::: zone-end
246-
+ [Azure Functions triggers and bindings](functions-triggers-bindings.md).
247+
+ [Azure Functions triggers and bindings](functions-triggers-bindings.md)
247248

248249
+ [Functions pricing page](https://azure.microsoft.com/pricing/details/functions/)
249250

250-
+ [Estimating Consumption plan costs](functions-consumption-costs.md) article.
251+
+ [Estimating Consumption plan costs](functions-consumption-costs.md)

0 commit comments

Comments
 (0)