Learn more about Microsoft Azure Blob Storage Import Integration.
This article explains how to write job results directly to your Microsoft Azure Blob Storage.
For sample workflows of exporting to Microsoft Azure Blob Storage, view Treasure Boxes.
- Basic knowledge of Treasure Data, including the TD Toolbelt.
- A Microsoft Azure Platform account
First, you need to create an Azure Storage account. Here’s documentation about how to create it.
In the Azure Portal, navigate to your storage account, select All Settings, and then select Access keys to obtain account access keys.
Create your container of Azure Blob Storage from your Azure portal.
Also, check the Naming and Referencing Containers, Blobs, and Metadata roles.
Visit the TD Console query editor page and compile your query.
In the same window, select the Add button in the Result Export section and select Microsoft Azure Blob Storage from the drop-down menu. Edit all of your credentials information, including your Account Name, Account Key, Container, and Path.

- Navigate to Data Workbench > Queries.
- Select an existing query or create a new one**.**
- In the query editor, select the Export Results checkbox.

- Select your Microsoft Azure connection
- The Export Results dialog pane opens. Edit the following parameters.
| Parameters | Description | |
|---|---|---|
| Container (container) | Azure blob container name | |
| Path prefix (path_prefix) | Files will be stored at this path | |
| Blob Type (blob_type) | UNSPECIFIED or BLOCK_BLOB. Specify BLOCK_BLOB if your result is very large | |
| Format (format) | The output file format (csv or tsv) | |
| Compression (Encoders) | Compress output file. Supported compressions: Gzip or Bzip2 (gz / bz2) | |
| public_key | The public key to use for encryption | String |
| key_identifier | Specifies the Key ID of the encryption subkey used to secure the file. The master key is excluded from the encryption process. (string, required) | String |
| amor | Use ASCII armor for the encrypted output (boolean) | Boolean |
| compression_type | The compression type determines whether to compress the data before encrypting it. Supported values - gzip --> For example, file extension will be .csv.gz.gpg - bzip2 --> For example, file extension will be .csv.bz2.gpg - none --> For example, file extension will be .csv.gpg - zip_builtin --> For example, file extension will be .csv.zip.gpg - zlip_builtin --> For example, file extension will be .csv.z.gpg - bzip2_builtin --> For example, file extension will be .csv.bz2.gpgNote: Please ensure that you compress your file before encrypting and uploading. When you decrypt it, the file will revert to its original compressed format, such as .gz or .bz2. | String |
| Delimiter (delimiter) | Delimiter character such as "," for CSV, "\t" for TSV, " | " or any single-byte character |
| Null string (null_string) | Use this value to represent NULL values. Defaults to an empty string | |
| End-of-line character (newline) | End of line character of the result file |
Either save the query with a name and run or just run the query. Upon successful completion of the query, the results are automatically imported to the specified container destination.
You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify.
Treasure Data's scheduler feature supports periodic query execution to achieve high availability.
When two specifications provide conflicting schedule specifications, the specification requesting to execute more often is followed while the other schedule specification is ignored.
For example, if the cron schedule is '0 0 1 * 1', then the 'day of month' specification and 'day of week' are discordant because the former specification requires it to run every first day of each month at midnight (00:00), while the latter specification requires it to run every Monday at midnight (00:00). The latter specification is followed.
Navigate to Data Workbench > Queries
Create a new query or select an existing query.
Next to Schedule, select None.

In the drop-down, select one of the following schedule options:

Drop-down Value Description Custom cron... Review Custom cron... details. @daily (midnight) Run once a day at midnight (00:00 am) in the specified time zone. @hourly (:00) Run every hour at 00 minutes. None No schedule.

| Cron Value | Description |
|---|---|
0 * * * * | Run once an hour. |
0 0 * * * | Run once a day at midnight. |
0 0 1 * * | Run once a month at midnight on the morning of the first day of the month. |
| "" | Create a job that has no scheduled run time. |
* * * * *
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +---------- month (1 - 12)
| | +--------------- day of month (1 - 31)
| +-------------------- hour (0 - 23)
+------------------------- min (0 - 59)The following named entries can be used:
- Day of Week: sun, mon, tue, wed, thu, fri, sat.
- Month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.
A single space is required between each field. The values for each field can be composed of:
| Field Value | Example | Example Description |
|---|---|---|
| A single value, within the limits displayed above for each field. | ||
A wildcard '*' to indicate no restriction based on the field. | '0 0 1 * *' | Configures the schedule to run at midnight (00:00) on the first day of each month. |
A range '2-5', indicating the range of accepted values for the field. | '0 0 1-10 * *' | Configures the schedule to run at midnight (00:00) on the first 10 days of each month. |
A list of comma-separated values '2,3,4,5', indicating the list of accepted values for the field. | 0 0 1,11,21 * *' | Configures the schedule to run at midnight (00:00) every 1st, 11th, and 21st day of each month. |
A periodicity indicator '*/5' to express how often based on the field's valid range of values a schedule is allowed to run. | '30 */2 1 * *' | Configures the schedule to run on the 1st of every month, every 2 hours starting at 00:30. '0 0 */5 * *' configures the schedule to run at midnight (00:00) every 5 days starting on the 5th of each month. |
A comma-separated list of any of the above except the '*' wildcard is also supported '2,*/5,8-10'. | '0 0 5,*/10,25 * *' | Configures the schedule to run at midnight (00:00) every 5th, 10th, 20th, and 25th day of each month. |
- (Optional) You can delay the start time of a query by enabling the Delay execution.
Save the query with a name and run, or just run the query. Upon successful completion of the query, the query result is automatically exported to the specified destination.
Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications.
(Optional) You can delay the start time of a query by enabling the Delay execution.
You can also send segment data to the target platform by creating an activation in the Audience Studio.
- Navigate to Audience Studio.
- Select a parent segment.
- Open the target segment, right-mouse click, and then select Create Activation.
- In the Details panel, enter an Activation name and configure the activation according to the previous section on Configuration Parameters.
- Customize the activation output in the Output Mapping panel.

- Attribute Columns
- Select Export All Columns to export all columns without making any changes.
- Select + Add Columns to add specific columns for the export. The Output Column Name pre-populates with the same Source column name. You can update the Output Column Name. Continue to select + Add Columnsto add new columns for your activation output.
- String Builder
- + Add string to create strings for export. Select from the following values:
- String: Choose any value; use text to create a custom value.
- Timestamp: The date and time of the export.
- Segment Id: The segment ID number.
- Segment Name: The segment name.
- Audience Id: The parent segment number.
- + Add string to create strings for export. Select from the following values:
- Set a Schedule.

- Select the values to define your schedule and optionally include email notifications.
- Select Create.
If you need to create an activation for a batch journey, review Creating a Batch Journey Activation.
You can also use CLI for Result Export to Microsoft Azure Blob Storage.
td query --result '{"type":"azure_blob_storage","account_name":"xxxx","account_key":"xxxx","container":"xxxx","path_prefix":"/path/to/file.csv","sequence_format":"","header_line":true,"quote_policy":"MINIMAL","delimiter":",","null_string":"","newline":"CRLF"}' -d sample_datasets "select * from www_access" -T prestoWithin Treasure Workflow, you can specify the use of this data connector to output data.
timezone: UTC
_export:
td:
database: sample_datasets
+td-result-into-target:
td>: queries/sample.sql
result_connection: my_azure_blob
result_settings:
container: test_container
path_prefix: /path/to/file.csv
format: csv
blob_type: BLOCK_BLOBLearn more about using data connectors to export data in workflows using CLI.
- The Embulk-encoder-Encryption document: https://docs.treasuredata.com/articles/#!project-integrations/~embulk-encoder-encryption-pgp