az storage message

Manage queue storage messages.

Please specify one of the following authentication parameters for your commands: --auth-mode, --account-key, --connection-string, --sas-token. You also can use corresponding environment variables to store your authentication credentials, e.g. AZURE_STORAGE_KEY, AZURE_STORAGE_CONNECTION_STRING and AZURE_STORAGE_SAS_TOKEN.

Commands

az storage message clear

Delete all messages from the specified queue.

az storage message delete

Delete the specified message.

az storage message get

Retrieve one or more messages from the front of the queue.

az storage message peek

Retrieve one or more messages from the front of the queue, but do not alter the visibility of the message.

az storage message put

Add a new message to the back of the message queue.

az storage message update

Update the visibility timeout of a message.

az storage message clear

Delete all messages from the specified queue.

az storage message clear --queue-name
                         [--account-key]
                         [--account-name]
                         [--auth-mode {key, login}]
                         [--connection-string]
                         [--queue-endpoint]
                         [--sas-token]
                         [--timeout]

Examples

Delete all messages from the specified queue.

az storage message clear -q myqueue --account-name mystorageaccount

Required Parameters

--queue-name -q

The queue name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--queue-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--timeout

Request timeout in seconds. Applies to each call to the service.

az storage message delete

Delete the specified message.

az storage message delete --id
                          --pop-receipt
                          --queue-name
                          [--account-key]
                          [--account-name]
                          [--auth-mode {key, login}]
                          [--connection-string]
                          [--queue-endpoint]
                          [--sas-token]
                          [--timeout]

Examples

Delete the specified message.

az storage message delete --id messageid --pop-receipt popreceiptreturned -q myqueue --account-name mystorageaccount

Required Parameters

--id

The message id identifying the message to delete.

--pop-receipt

A valid pop receipt value returned from an earlier call to the :func:~get_messages or :func:~update_message operation.

--queue-name -q

The queue name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--queue-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--timeout

Request timeout in seconds. Applies to each call to the service.

az storage message get

Retrieve one or more messages from the front of the queue.

az storage message get --queue-name
                       [--account-key]
                       [--account-name]
                       [--auth-mode {key, login}]
                       [--connection-string]
                       [--num-messages]
                       [--queue-endpoint]
                       [--sas-token]
                       [--timeout]
                       [--visibility-timeout]

Examples

Retrieve one message from the front of the queue and reset the visibility timeout to 5 minutes later.

az storage message get -q myqueue --visibility-timeout 300 --account-name mystorageaccount

Required Parameters

--queue-name -q

The queue name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--num-messages

A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this operation.

default value: 1
--queue-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--timeout

Request timeout in seconds. Applies to each call to the service.

--visibility-timeout

Specify the new visibility timeout value, in seconds, relative to server time. The new value must be larger than or equal to 1 second, and cannot be larger than 7 days. The visibility timeout of a message can be set to a value later than the expiry time.

az storage message peek

Retrieve one or more messages from the front of the queue, but do not alter the visibility of the message.

az storage message peek --queue-name
                        [--account-key]
                        [--account-name]
                        [--auth-mode {key, login}]
                        [--connection-string]
                        [--num-messages]
                        [--queue-endpoint]
                        [--sas-token]
                        [--timeout]

Examples

Retrieve 5 messages from the front of the queue (do not alter the visibility of the message).

az storage message peek -q myqueue --num-messages 5 --account-name mystorageaccount

Required Parameters

--queue-name -q

The queue name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--num-messages

A nonzero integer value that specifies the number of messages to peek from the queue, up to a maximum of 32. By default, a single message is peeked from the queue with this operation.

--queue-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--timeout

Request timeout in seconds. Applies to each call to the service.

az storage message put

Add a new message to the back of the message queue.

az storage message put --content
                       --queue-name
                       [--account-key]
                       [--account-name]
                       [--auth-mode {key, login}]
                       [--connection-string]
                       [--queue-endpoint]
                       [--sas-token]
                       [--time-to-live]
                       [--timeout]
                       [--visibility-timeout]

Examples

Add a new message which will live one day.

az storage message put -q myqueue --content mymessagecontent --time-to-live 86400 --account-name mystorageaccount

Required Parameters

--content

Message content, up to 64KB in size.

--queue-name -q

The queue name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--queue-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--time-to-live

Specify the time-to-live interval for the message, in seconds. The time-to-live may be any positive number or -1 for infinity. If this parameter is omitted, the default time-to-live is 7 days.

--timeout

Request timeout in seconds. Applies to each call to the service.

--visibility-timeout

If not specified, the default value is 0. Specify the new visibility timeout value, in seconds, relative to server time. The value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility timeout of a message cannot be set to a value later than the expiry time. visibility_timeout should be set to a value smaller than the time_to_live value.

az storage message update

Update the visibility timeout of a message.

az storage message update --id
                          --pop-receipt
                          --queue-name
                          [--account-key]
                          [--account-name]
                          [--auth-mode {key, login}]
                          [--connection-string]
                          [--content]
                          [--queue-endpoint]
                          [--sas-token]
                          [--timeout]
                          [--visibility-timeout]

Examples

Update the visibility timeout and content of a message.

az storage message update --id messageid --pop-receipt popreceiptreturned -q myqueue
--visibility-timeout 3600 --content newmessagecontent --account-name mystorageaccount

Required Parameters

--id

The message id identifying the message to delete.

--pop-receipt

A valid pop receipt value returned from an earlier call to the :func:~get_messages or :func:~update_message operation.

--queue-name -q

The queue name.

Optional Parameters

--account-key

Storage account key. Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_KEY.

--account-name

Storage account name. Related environment variable: AZURE_STORAGE_ACCOUNT. Must be used in conjunction with either storage account key or a SAS token. If neither are present, the command will try to query the storage account key using the authenticated Azure account. If a large number of storage commands are executed the API quota may be hit.

--auth-mode

The mode in which to run the command. "login" mode will directly use your login credentials for the authentication. The legacy "key" mode will attempt to query for an account key if no authentication parameters for the account are provided. Environment variable: AZURE_STORAGE_AUTH_MODE.

accepted values: key, login
--connection-string

Storage account connection string. Environment variable: AZURE_STORAGE_CONNECTION_STRING.

--content

Message content, up to 64KB in size.

--queue-endpoint

Storage data service endpoint. Must be used in conjunction with either storage account key or a SAS token. You can find each service primary endpoint with az storage account show. Environment variable: AZURE_STORAGE_SERVICE_ENDPOINT.

--sas-token

A Shared Access Signature (SAS). Must be used in conjunction with storage account name or service endpoint. Environment variable: AZURE_STORAGE_SAS_TOKEN.

--timeout

Request timeout in seconds. Applies to each call to the service.

--visibility-timeout

If not specified, the default value is 0. Specify the new visibility timeout value, in seconds, relative to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility timeout of a message cannot be set to a value later than the expiry time. A message can be updated until it has been deleted or has expired.