Create an Azure Storage Queue
This guide demonstrates how to create a new Azure Storage Queue using the Azure CLI and Azure Portal. Azure Queues is a service that provides reliable messaging for applications. It allows you to decouple components of your application and scale them independently.
- An Azure account. If you don't have one, create a free account.
- A storage account in your Azure subscription. If you don't have one, you can create it via the Azure Portal or Azure CLI.
- Azure CLI installed and configured, or access to the Azure Portal.
Method 1: Using the Azure CLI
The Azure Command-Line Interface (CLI) provides a powerful and scriptable way to manage Azure resources. You can use it to create a new storage queue in a few simple steps.
1. Log in to your Azure account
Open your terminal or command prompt and run the following command:
az login
This will open a browser window for you to authenticate.
2. Set your subscription (if you have multiple)
If you have multiple Azure subscriptions, ensure you have the correct one selected:
az account set --subscription "<YOUR_SUBSCRIPTION_ID_OR_NAME>"
Replace <YOUR_SUBSCRIPTION_ID_OR_NAME> with your actual subscription ID or name.
3. Create the storage queue
Use the az storage queue create command to create a new queue. You'll need your storage account name and a key (or use a connection string).
To get your storage account name and key, you can use:
az storage account show --name <YOUR_STORAGE_ACCOUNT_NAME> --resource-group <YOUR_RESOURCE_GROUP_NAME> --query "[accountName, primaryKey]" -o tsv
Then, use the queue create command:
az storage queue create --name <YOUR_QUEUE_NAME> --account-name <YOUR_STORAGE_ACCOUNT_NAME> --account-key <YOUR_STORAGE_ACCOUNT_KEY>
Alternatively, you can use a connection string:
az storage queue create --name <YOUR_QUEUE_NAME> --connection-string "<YOUR_CONNECTION_STRING>"
Replace the placeholders with your specific details (e.g., my-new-queue, mystorageaccount123, YOUR_RESOURCE_GROUP_NAME, YOUR_STORAGE_ACCOUNT_KEY, YOUR_CONNECTION_STRING).
Queue names must be between 3 and 63 characters long and can contain lowercase letters, numbers, and hyphens. They cannot start or end with a hyphen.
Method 2: Using the Azure Portal
The Azure Portal offers a user-friendly graphical interface for managing your Azure resources.
Sign in to the Azure Portal.
Navigate to your existing storage account. You can search for "Storage accounts" and select your account from the list.
In the storage account menu, under the "Data storage" section, select "Queues".
Click the "+ Queue" button at the top of the Queues blade.
In the "Create queue" pane that appears:
- Enter a unique name for your queue in the "Name" field (e.g.,
my-new-queue). - You can optionally set access policies if needed (typically, queues are accessed programmatically).
Click "OK" to create the queue.
Verification
Once created, your new queue will appear in the list of queues for your storage account in both the Azure CLI (using az storage queue list) and the Azure Portal.