Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Azure icon
Labs

Interacting with Azure Queues Using REST

Azure Queues are a great way to provide reliable, cloud-based messaging between applications. There are multiple ways in which you can interact with Queues, including through the use of RESTful API calls. In this lab, you will have the opportunity to read from and write to an Azure Queue using the Azure Queue service REST API.

Azure icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 23, 2025
Duration
45m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Save a list of the current messages to a file.
    1. Set up some environment variables to aid in generating a signature. For the storage_account and access_key, provide the actual storage account name and access key. One way to obtain these is to log in to the Azure portal. The access key can be found by clicking the storage account, then clicking Access Keys:
    storage_account=${your storage account name}
    
    access_key=${your storage account access key}
    
    queue_name=incoming-items
    
    request_date=$(TZ=GMT date "+%a, %d %h %Y %H:%M:%S %Z")
    
    resource="/${storage_account}/${queue_name}/messages"
    
    request_method="GET"
    
    headers="x-ms-date:$request_date"
    
    1. Generate a signature and Authorization header:
    string_to_sign="${request_method}\n\n\n\n${headers}\n${resource}"
    
    hex_key="$(echo -n $access_key | base64 -d -w0 | xxd -p -c256)"
    
    signature=$(printf "$string_to_sign" | openssl dgst -sha256 -mac HMAC -macopt "hexkey:$hex_key" -binary |  base64 -w0)
    
    authorization_header="SharedKey $storage_account:$signature"
    
    1. Make a request to peek the current messages in the queue, redirecting the output to a file:
    curl -s -X $request_method 
      -H "x-ms-date:$request_date" 
      -H "Authorization:$authorization_header" 
      "https://${storage_account}.queue.core.windows.net/${queue_name}/messages?peekonly=true&numofmessages=32" 
      > /home/cloud_user/messages.txt
    
    1. Check the contents of the file to see the messages:
    cat /home/cloud_user/messages.txt
    

    You should see some XML representing one existing message.

  2. Challenge

    Manually add the lost data to the queue.
    1. Set up some environment variables to aid in generating a signature.
    request_date=$(TZ=GMT date "+%a, %d %h %Y %H:%M:%S %Z")
    
    resource="/${storage_account}/${queue_name}/messages"
    
    request_method="POST"
    
    content_type="application/x-www-form-urlencoded; charset=utf-8"
    
    storage_service_version="2018-11-09"
    
    headers="x-ms-date:$request_date\nx-ms-version:$storage_service_version"
    
    message="Item 4489: Coin Collection"
    
    message_base64=$(echo $message | base64)
    
    message_xml="<QueueMessage><MessageText>$message_base64</MessageText></QueueMessage>"
    
    message_length=${#message_xml}
    
    1. Generate a signature and Authorization header.
    string_to_sign="${request_method}\n\n\n$message_length\n\n$content_type\n\n\n\n\n\n\n${headers}\n${resource}\nmessagettl:-1"
    
    hex_key="$(echo -n $access_key | base64 -d -w0 | xxd -p -c256)"
    
    signature=$(printf "$string_to_sign" | openssl dgst -sha256 -mac HMAC -macopt "hexkey:$hex_key" -binary |  base64 -w0)
    
    authorization_header="SharedKey $storage_account:$signature"
    
    1. Make a request to peek the current messages in the queue, redirecting the output to a file.
    curl -X $request_method 
      -H "x-ms-date:$request_date" 
      -H "x-ms-version:$storage_service_version" 
      -H "Content-Type:$content_type" 
      -H "Authorization:$authorization_header" 
      --data "$message_xml" 
      "https://${storage_account}.queue.core.windows.net/${queue_name}/messages?messagettl=-1"
    
    1. If you wish, you can check the Queue in Azure Portal to verify that your new message appears.
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight