IMD SolutionComputing LibraryShop main store

Explainer

Canary historian to Azure Blob Storage: the file path

Edge computing and IIoT Published 9 min read

Short answer

A Canary historian cannot connect to Azure Blob Storage as a database. The working path is an extraction job that reads tags through a documented interface, stages closed CSV files on a separate server, and uploads them outbound over HTTPS to a private container, one verified stage at a time.

On this page
  1. Can a Canary historian connect to Azure Blob Storage directly?
  2. Which documented interface reads the tag data out of the historian?
  3. Where should the extraction job run?
  4. How do you split the data into files Blob Storage accepts?
  5. What does the upload into Blob Storage use?
  6. How much staging disk and upload bandwidth does the transfer need?
  7. How do you prove the pipeline end to end?
  8. What do failures look like in the cloud copy?
  9. Questions asked

A Canary historian never talks to Azure Blob Storage the way it talks to another historian: blob storage holds files, so the working design is extract, stage, upload. An extraction job you build reads the tags through an interface the manufacturer documents, writes closed CSV or Parquet files on a staging server, and pushes them outbound over HTTPS to a private container. Build the chain one stage at a time and prove each stage before adding the next — one tag for one hour, then one checksummed upload, then a restart test. This article walks that path: which interface reads the data, where the job runs, how to shape the windows, what the upload needs, and the numbers that size the staging disk and the uplink.

Can a Canary historian connect to Azure Blob Storage directly? #

No. Azure Blob Storage stores files, not a historian database, so there is no connection string from Canary to a blob container; the transfer is a job that reads tags through a documented interface, stages closed files on a server you control, and uploads them outbound over HTTPS.

A blob container is a flat set of objects reached over HTTP or HTTPS. It has no tag tree, no subscription, and no query engine, so "connecting" the historian to it is not a configuration step on either product. The unit of transfer is a file, which makes the pipeline a small extract job plus an upload client, and it makes closed, immutable files the natural grain of the transfer. The other documented outbound path, publishing tag data as messages to a broker, is covered in Canary historian export paths: MQTT publisher or API read; this article takes the file path.

Which documented interface reads the tag data out of the historian? #

Read through an interface the manufacturer documents — the Views Web API, the ODBC/SQL-style connector, or the bundled export tooling — and never point a third-party tool at the historian's on-disk store; the logging service owns those files, and an outside reader can return partial blocks or fail after an upgrade.

The vendor's own sample code shows the pattern: scripts that export CSV and an exporter that writes Apache Parquet, both reading through the Views Web API. Your installed version and license decide which of these your system offers, so take the list from the vendor's data-transfer documentation and the documentation that ships with your installation.

Option Where it runs Trade-off
Views Web API query Script or service on a job server Time-bounded, tag-filtered reads; you maintain the extraction code
ODBC/SQL-style connector Standard ETL tool on the network Fits existing tooling; query load lands on the historian host
Bundled export feature Historian host or job server Least custom code; output format and destination are fixed by the vendor

When two options both work, take the read API or the export feature over a generic connector: the load pattern stays predictable and the configuration stays inside what the manufacturer supports. Check the choice before moving on: pull one tag for a one-hour window and compare the first timestamp, the last timestamp and the sample count against the historian's own trend view for the same window.

Where should the extraction job run? #

Run the extraction on a separate server in the same plant network zone as the historian, under a dedicated read-only account — not on the historian host, where a backfill query competes with live logging for CPU and disk and shows up as gaps in live trends.

Give that job server exactly three network rights: read access to the historian on the one port the chosen interface uses (the product documentation names it), outbound HTTPS to the storage endpoint, and nothing else. Throttle the job by tags per request and time span per request, and schedule historical backfills outside the shifts that matter. The job itself is a light workload — any compact fanless industrial mini PC mounted alongside the historian host carries it. Check the placement the same way as the interface: rerun the one-hour pull while watching CPU and disk queue on the logging host, and confirm the live logging rate does not move.

How do you split the data into files Blob Storage accepts? #

Write one closed, immutable file per tag group per time window, in UTC, with the tag's full path and quality value in every row; Blob Storage has no row update, so a file that keeps growing would have to be re-uploaded whole each time.

Four rules shape the windows:

  • Timestamps in UTC, tag name as the full stored path, quality exported with each sample, so downstream users can filter bad values and map rows back to the source.
  • Window start inclusive, window end exclusive, so adjacent windows neither overlap nor repeat the edge sample.
  • The window closes a safety margin before now; set that margin to the longest buffering interval in your collector fleet — if a store-and-forward collector can hold data up to 60 minutes, close hourly windows 60 minutes behind.
  • The file name encodes dataset and window boundaries, so replaying a window overwrites the same blob instead of duplicating it.

Record the last successfully exported window end in a small state file on the job server, so a restart resumes from it instead of re-reading history or skipping to the present. Check the shaping: export two adjacent windows and confirm no overlap and no gap larger than the tag's logging interval.

What does the upload into Blob Storage use? #

The upload is a block blob put over HTTPS from the job server, driven by the Azure Storage client library for .NET or Python or an equivalent supported upload tool; the container stays private and the credential is a scoped, expiring token for that one container, not the account-wide key.

Open outbound HTTPS from the job server to the storage endpoint on the firewall and block every other destination from that server. Upload each closed file, then delete or archive the local copy only after the upload reports success. When the call returns 403, the cause is almost always credential scope or expiry rather than reachability; the same signature is walked through in the knowledge-base page on an Azure Blob Storage PUT request 403 error. If the plant network has no direct internet path, stage the files on a share in the DMZ and let a second server there run the upload, which keeps the cloud credential off the control network. One safety rule holds for every variant: never open an inbound path from the cloud to the plant network — the historian zone accepts no connection that originates on the internet.

How much staging disk and upload bandwidth does the transfer need? #

Size staging from the sample rate: 200 tags logging once each second at roughly 80 bytes per CSV row produce one 57.6 MB file per hourly window, about 1.4 GB per day, so 20 GB of staging disk and a 2 Mbit/s uplink clear the whole daily volume with room for retries.

The worked example, with the arithmetic shown:

  • Assumptions: 200 tags, 1 sample per second, CSV rows of about 80 bytes (UTC timestamp, full tag path, value, quality).
  • One hourly window: 200 tags × 3,600 s × 80 B = 57,600,000 B = 57.6 MB per file, 24 files per day.
  • One day: 200 × 86,400 s × 80 B = 1,382,400,000 B ≈ 1.4 GB.
  • Staging for seven days of closed files: 7 × 1.4 GB ≈ 9.7 GB; keep 20 GB free so a week of undelivered files plus the running window fit even after an outage.
  • Uplink: 1.4 GB × 8 bits = 11.06 Gbit per day; over a 2 Mbit/s outbound allowance that is 11.06 Gbit ÷ 2 Mbit/s ≈ 5,530 s ≈ 92 minutes of continuous transfer, so a full day drains within a couple of hours.

Everything scales linearly: double the tag count or the logging rate and every figure above doubles. The decision for this example: hourly windows, 20 GB of staging disk, and at least the sized outbound allowance on the firewall rule.

How do you prove the pipeline end to end? #

Prove each stage before adding the next: one tag, one hour, compared against the historian's own trend view; then a checksum on one uploaded blob; then a restart and an outage test against the state file, with known tags, values and timestamps as the acceptance criteria.

The sequence:

  1. Pick a tag that changes often and one that rarely changes. Export a 24-hour window that has already closed.
  2. Query the same window directly from the historian and from the blob files. Compare sample counts, first and last timestamps, minimum, maximum and quality distribution per tag.
  3. Upload one file, list the container from a different machine, and compare blob size and a checksum against the staged local file.
  4. Stop the job mid-run and restart it. The state file must resume at the last closed window, and the container listing must show no duplicated and no missing window.
  5. Disable the outbound rule, let two windows accumulate in staging, restore the rule, and confirm both windows upload and the local copies clear only after success.
  6. Finish by reading one known tag, value and timestamp out of the blob content itself — a file present in the container is not the same as correct data in it.

What do failures look like in the cloud copy? #

Read the symptom in the cloud copy first, then walk it back toward the historian, because extraction faults and upload faults leave different signatures — even hourly gaps point at window logic or a time-zone offset, while zero-byte blobs point at an upload against a file still being written.

Symptom in the cloud data Likely cause Where to look
Gaps of the same length each cycle Window boundary drops the edge sample, or a time-zone offset in the query Window start and end logic; UTC handling
Duplicate rows at a window edge Both ends of adjacent windows inclusive Start inclusive, end exclusive
Latest window changes after export Late or buffered data from a collector Widen the closed-window margin, replay the window
Tags missing, others fine Read-only account lacks that tag group, or a tag was renamed Account permissions; tag list in the job config
Empty or zero-byte blobs Upload ran against a file still being written Write to a temporary name, rename after close
Uploads fail intermittently Proxy, TLS inspection, or an expired credential Firewall logs; credential expiry

The decision, case by case: there is no direct historian-to-blob connection to configure, so build extract, then stage, then upload; read through the Views Web API or the vendor export feature rather than a generic connector; run it on a job server, not the historian host; cut closed hourly files with the margin your collectors dictate; upload outbound over HTTPS with a scoped credential; and accept the pipeline only on known tags, values and timestamps.

Questions asked

Can the staged files go to Blob Storage as Parquet instead of CSV?

Yes. The vendor's sample code repository includes an exporter that writes Apache Parquet alongside its CSV export scripts, both reading through the Views Web API. Parquet keeps the hourly files smaller and common analytics tools read it directly, but every downstream reader has to handle the column types you choose at export time.

Can the data reach Azure through MQTT instead of a file upload?

Yes, and it is the lighter path when a subscriber can consume a live feed. A Canary historian can publish tag data to an MQTT broker, and a service on the Azure side lands the messages where they are needed. File export suits bulk backfills and long-term archives; message publishing suits live forwarding.

Does the upload need the storage account key stored on the job server?

No. A scoped, expiring shared access signature limited to the one container is enough for a job server outside Azure, and a managed identity removes stored secrets entirely when the uploader itself runs inside Azure. Whichever identity you pick, grant write on that container only and track the expiry date in your maintenance calendar.

What happens to a window that was exported before late samples arrived?

Nothing, unless you replay it. Because each file name encodes the dataset and the window boundaries, exporting the same window again overwrites the same blob instead of creating a duplicate. That is the intended repair: widen the closed-window margin, replay the affected windows, and verify them against the historian.

Keep reading

  • Selection guide

    Selecting a route from PI data to Azure Machine Learning Studio

    Export a text file from the PI Integrator for Business Analytics Text File target and import that file into Studio: it is the only pairing of the two products' published connectors that moves PI data without an intermediate database. Host the same file over HTTP when Studio must pull on a schedule, and reject Cosmos DB and every database target because each one stores PI data in a database.

    Edge computing and IIoT

  • How-to

    Export CSV when a Canary historian event closes a batch

    Canary has no built-in trigger that exports CSV when a batch completes. The export client reads the closed event's start and end timestamps, from the events query in the Read API or from an external SQL events table, pulls the tag data for exactly that range resampled at your CSV interval, and writes a file named from the event. Wait one to two minutes past the event close, and page a 7-hour, 1-second, 40-tag pull into hour blocks.

    Edge computing and IIoT

  • How-to

    Export historian trend CSV at one-minute intervals

    Export the trend's recorded values and you get change-based events, about 17 minutes apart in this case, because the historian stores a value only when it changes. To get one row every minute, query the tag in the Query tool with regularly spaced retrieval at a 60-second interval and export that result; the grid comes from retrieval, not storage.

    Edge computing and IIoT