MSBA-273 · Lesson 5 of 12 · 20 min

Virtual and elastic tables

▶ Video coming soon A video version of this lesson is on the way.

Two requests reached the fifth session from opposite directions. The energy manager kept monthly meter readings for every building in an Azure SQL database that a contractor maintained, and Facilities coordinators wanted to see a building's recent readings on the building form without a second login or a copy of the data. Meanwhile the D4 alarm design from the last session needed somewhere to put thousands of short-lived alarm events a day. Signe used the two requests to compare the three kinds of Dataverse table: standard tables, which store data in Dataverse's relational store; virtual tables, which store nothing and read from another system on demand; and elastic tables, which store data in a different engine built for scale.

Three columns. Standard table: data in Dataverse relational storage, full features. Virtual table: data stays in the external source such as SQL Server or SharePoint, fetched on each request through a provider. Elastic table: data in Azure Cosmos DB behind Dataverse, very high scale, time to live, some features limited. All three are reached through the same Dataverse API and security roles.
Three kinds of table behind one Dataverse interface.

The same interface, different storage

From the outside all three kinds look alike. Apps, flows, the Web API and the SDK use the same messages, the same query options and the same security roles. That is the point: an integration can be changed from one storage choice to another without rewriting every caller. Inside, the differences are large, and each choice gives up something to gain something else.

Standard, virtual and elastic tables compared.
QuestionStandard tableVirtual tableElastic table
Where the data livesDataverse relational storageThe external systemAzure Cosmos DB, managed by Dataverse
Copies the dataYes, it is the system of recordNo, reads on demandYes, it is the system of record
Typical volumeUp to millions of rowsWhatever the source holdsVery high write and read volumes
Transactions across rowsYesDepends on the sourceLimited
Feature coverageFullReducedReduced
Good forCore business recordsData owned and maintained elsewhereEvents, logs, telemetry, large simple data sets

Virtual tables

A virtual table is a Dataverse table definition whose rows come from somewhere else. When an app or API asks for rows, Dataverse passes the query to a data provider, which fetches the matching rows from the external source and returns them in Dataverse's format. Nothing is copied or synchronized. The data is as current as the source, and the source remains the system of record. That makes virtual tables attractive when the data is owned and maintained in another system and Dataverse users only need to see it, or occasionally update it, alongside their own records.

There are three kinds of provider. The virtual connector provider uses Power Platform connectors to reach the source and is the low-code route. The OData version 4 provider reads from any service that exposes a suitable OData endpoint. And a custom provider is a set of plug-ins that a developer writes to handle the Retrieve, RetrieveMultiple, Create, Update and Delete messages for the table, which can reach any source the plug-ins can call.

The virtual connector provider

Microsoft's documentation lists SQL Server, SharePoint, Snowflake and PostgreSQL as supported sources for the virtual connector provider, with Microsoft Fabric, Salesforce and Oracle in preview; Excel is described as a legacy path. A maker creates the virtual table from the table creation experience by choosing the connection and the source table, and Dataverse creates the table definition and a connection reference for the connection. The documentation notes several conditions worth checking before a design depends on the feature. The maker sees only connections they own. The source's primary name column must be a string. Environment variables for the connection details are supported for SQL Server and SharePoint sources. Creating virtual tables needs a Power Apps or Dynamics 365 license; licenses that come with Microsoft 365 or Teams are not enough.

When the source allows it, virtual connector tables support create, read, update and delete, and Dataverse security roles control who can do each. The connection itself, however, runs as the identity that created it. Every user who reads the virtual table reaches the source through that one connection, so the connection's account must have only the access the table needs in the source, and the Dataverse roles become the real gatekeeper for individual users.

Worked problem

The energy readings virtual table

Coordinators want to see a building's last twelve monthly meter readings on the building form. The readings are in an Azure SQL database maintained by a contractor and change only when the contractor loads a month's data. Should Lumenvale copy the readings into a standard table, or create a virtual table?

Show solution
  1. The data is owned and maintained in the SQL database, so a copy would need a sync job and could fall out of date.
  2. Coordinators only read the data; no Dataverse process writes to it.
  3. The volume is small: twelve rows per building per year, read when a form opens.
  4. SQL Server is a supported source for the virtual connector provider, and environment variables can carry the server and database names between environments.
  5. The connection account would get read-only access to one view in the database, and the Dataverse role would grant read on the virtual table to coordinators.

Answer: A virtual table over a read-only view is the better fit. Signe noted that if reports later needed the readings joined with work orders at scale, Fabric would be the place to do it, not the virtual table.

Limits of virtual tables

Virtual tables trade features for freshness. Because Dataverse does not hold the data, features that depend on stored data are limited or unavailable; for example, virtual tables are organization-owned rather than user-owned, so row-level ownership and sharing do not apply, and features such as auditing and offline use do not work the way they do for standard tables. Performance depends on the source and the network path to it: a form that shows a virtual table subgrid waits for the source to answer, and a view that sorts or filters on columns the source cannot index may be slow. The exact list of unsupported features changes from release to release, so Wiremu's checklist told reviewers to read the current list in Microsoft's documentation for the chosen provider before approving a design.

The source's own limits also apply. If the contractor's database throttles connections or goes offline for maintenance, the subgrid shows an error. That was acceptable for meter readings that coordinators glanced at. It would not be acceptable for data that a business process depended on, which is a sign that such data belongs in a standard table, kept current by a synchronization pattern from the next lesson.

Custom virtual table providers

When no connector or OData endpoint fits, a developer can write a custom provider. The developer registers a data provider and plug-ins for the data operations; when an app queries the virtual table, Dataverse calls the RetrieveMultiple plug-in with the query, and the plug-in translates it into a call to the external system and returns the results as Dataverse rows. Plug-ins are subject to the usual sandbox rules, including the two-minute execution limit, so the external call must be fast. Credentials for the external system belong in an environment variable backed by Azure Key Vault, or behind a managed identity, never in plug-in code.

Wiremu asked whether a custom provider could expose LedgerPoint's supplier list as a virtual table through its read-only reporting API. It could in principle. Signe's concern was the reporting API's performance: it was built for nightly reports, not for every form load. She kept the idea for the capstone design review in Lesson 12, where it would be compared with copying a nightly snapshot.

Elastic tables

Elastic tables keep the Dataverse interface and security but store their rows in Azure Cosmos DB. They are designed for data that arrives in large volumes, is written far more often than it is changed, and does not need the full feature set of standard tables: telemetry, events, logs, audit-style histories and large sets of simple records. They scale horizontally, accept very high write rates, and support features that suit that kind of data.

Features that make elastic tables suit high-volume data.
FeatureWhat it means
Time to liveA ttlinseconds column deletes each row automatically after the given number of seconds
PartitioningAn optional partitionid column groups related rows so that queries within a partition are efficient
JSON columnsColumns can hold JSON documents that can be queried
Bulk operationsCreateMultiple, UpdateMultiple, UpsertMultiple and DeleteMultiple are all supported and allow partial success
SecurityThe same Dataverse security roles apply

The partition identifier deserves care. If an elastic table uses partitionid, rows with the same value are stored together, and operations that address a single row should supply both the row's identifier and its partition identifier. For the D4 alarm events, the design used the building code as the partition identifier, because the summarizing function always read alarms one building at a time.

Limits of elastic tables

Elastic tables give up some of what standard tables offer. Transactions across multiple rows are limited, so a set of changes cannot be relied upon to succeed or fail together the way a change set does on standard tables; bulk operations on elastic tables can partly succeed and report which rows failed. Several features available to standard tables, such as some relationship types, calculated and rollup columns and business process flows, are not available or behave differently. Queries are efficient within a partition and on the primary key, and less so across the whole table. As with virtual tables, the current list of supported features is in Microsoft's documentation and changes over time.

The practical test is whether the data is a business record or a stream of events. A work order is a business record: people edit it, it moves through stages, it has related tasks and costs, and it needs every feature. An alarm event is a stream item: it is written once, read by a summarizing process and discarded after a month. The first belongs in a standard table; the second is a natural fit for an elastic table.

Listing 5.1: The planned elastic table for D4 (a design summary, not executable).
// Planned lcc_alarmevent definition (elastic), summarized for the design review
Table type:         Elastic
Primary name:       lcc_name           (gateway alarm identifier)
Partition:          partitionid        = building code, for example LSB
Columns:            lcc_point          (text)
                    lcc_severity       (choice: 1 critical, 2 high, 3 normal)
                    lcc_raisedon       (date and time, UTC)
                    lcc_payload        (JSON, the original message)
Expiry:             ttlinseconds       = 2592000 (30 days)
Alternate key:      lcc_name + partitionid
Access:             Read and create for the ingest identity; read for the summarizing identity

Choosing a table type

Signe gave the group four questions to ask about any new data set. Who owns it: Dataverse, or another system that will remain the system of record? How will it be used: edited by people in business processes, read for reference, or written as a stream and summarized? How much of it will there be, and how fast will it arrive? And which Dataverse features does it need? The answers usually point clearly to one type.

A decision flow. First question: is another system the system of record and do users mainly read it here? Yes leads to virtual table. No leads to the second question: is it a high-volume stream of simple, short-lived records? Yes leads to elastic table. No leads to standard table.
Choosing between virtual, elastic and standard tables.

The group applied the questions to four data sets. Meter readings: owned by the contractor's database, read only, small, so virtual. Alarm events: a high-volume stream with a short life, so elastic. Work orders: business records edited by people, so standard. LedgerPoint suppliers: owned by LedgerPoint, read often, needed in business rules for purchase requests; the answer depended on the reporting API's performance and was left for the capstone.

Moving between table types later

Wiremu asked what would happen if a choice turned out wrong. A table's type is fixed when it is created, so changing from standard to elastic, or from virtual to standard, means creating a new table and moving the data and the components that use it. Because all three types share the Dataverse interface, the callers' code changes little, but forms, views, flows and security roles must be rebuilt for the new table, and any data must be migrated. Signe's advice was to make the choice deliberately at design time, record the reasons in the decision log, and prototype with realistic volumes before committing, rather than relying on a later switch.

Common mistakes

  • MistakeCopying data into a standard table when users only need to read it and another system owns it.

    InsteadConsider a virtual table so the data stays current without a sync job.

  • MistakeUsing a virtual table for data that business processes depend on when the source is slow or often offline.

    InsteadKeep that data in a standard table and synchronize it.

  • MistakeGiving the virtual table connection broad access to the source.

    InsteadUse a connection account limited to the views the table needs, and control users with Dataverse roles.

  • MistakeStoring a stream of events in a standard table and writing a clean-up job.

    InsteadUse an elastic table with time to live.

  • MistakeRelying on multi-row transactions in an elastic table.

    InsteadDesign for partial success and handle failed rows.

  • MistakeAssuming every standard-table feature works on virtual and elastic tables.

    InsteadCheck the current supported-feature lists before approving a design.

Summary and key terms

  • Standard, virtual and elastic tables share the Dataverse interface and security roles but store data differently.
  • Virtual tables read from the source on demand through the virtual connector provider, the OData provider or a custom plug-in provider.
  • The virtual connector provider supports SQL Server, SharePoint, Snowflake and PostgreSQL, with Fabric, Salesforce and Oracle in preview.
  • Virtual tables trade features and performance for freshness; the source remains the system of record.
  • Elastic tables use Azure Cosmos DB for high-volume data and offer time to live, partitioning, JSON columns and bulk operations with partial success.
  • Business records belong in standard tables; reference data owned elsewhere suits virtual tables; streams of events suit elastic tables.
Virtual table
A Dataverse table whose rows are read from an external source through a data provider rather than stored in Dataverse.
Data provider
The component that translates Dataverse operations on a virtual table into calls to the external source.
Virtual connector provider
A data provider that uses Power Platform connectors to reach sources such as SQL Server and SharePoint.
Elastic table
A Dataverse table stored in Azure Cosmos DB, designed for high-volume data with a reduced feature set.
Partition identifier
The partitionid value that groups related rows in an elastic table for efficient access.
System of record
The system whose copy of a piece of data is authoritative.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Why is a virtual table a poor choice for data a business rule must check on every save if the source is slow?

    Show answer

    Every save would wait for the source, and if the source is down the rule fails.

  2. What does ttlinseconds do on an elastic table?

    Show answer

    It deletes each row automatically after the given number of seconds.

  3. Whose identity does a virtual connector table use to reach the source?

    Show answer

    The connection's identity, which is shared by all users; Dataverse roles control access for individuals.

  4. Which kind of provider would you use for a source with no connector and no OData endpoint?

    Show answer

    A custom provider written as plug-ins.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz