TOM TMSL and TMDL
Three interfaces, three purposes
TOM (Tabular Object Model) is a .NET object API for manipulating tabular model metadata. TMSL (Tabular Model Scripting Language) represents commands and object definitions in JSON, sent to Analysis Services via XMLA. TMDL (Tabular Model Definition Language) is a readable, indentation-sensitive text representation of tabular definitions, suitable for file-based review. TOM and TMSL expose related objects but TOM does not send TMSL as its wire format. XMLA is the connection/protocol boundary, not the DAX language or a file format.
Choose the safest interface
Use TOM to enumerate objects and write controlled tooling; use TMSL for explicit administrative commands, such as a scoped refresh; use TMDL for reviewing object definitions and source control. The TMDL folder representation makes individual object changes easier to review. Power BI Desktop TMDL view supports scripting and previewing changes, with web availability dependent on feature status. Use an existing disposable local model and inspect the preview before applying anything; the baseline JSON here is not importable TMDL. XMLA read connectivity needs eligible capacity/configuration and appropriate Build access; writes additionally require read-write endpoint configuration, tenant settings and authorized write access. Never enable or change these for this exercise.
Example 1 — read-only TOM inventory
For a .NET console project with a compatible Microsoft.AnalysisServices.Tabular client library and an already-authorized local disposable model connection, the following is an illustrative fragment. model is a previously obtained Microsoft.AnalysisServices.Tabular.Model; no server is contacted here.
foreach (var table in model.Tables){ foreach (var measure in table.Measures) Console.WriteLine($"{table.Name} / {measure.Name}: {measure.Expression}");}Expected relevant line: Sales / Revenue: SUM(Sales[Amount]). The loop reads properties only. A complete program needs connection setup and disposal; do not dump expressions or metadata from real protected models. An edit such as assigning measure.Description changes the object in memory; committing it to a connected model is a separate operation not performed here.
Example 2 — compare a TMDL definition and TMSL command
This illustrative TMDL table fragment describes the approved target measure, not a complete import or an apply script:
table Sales /// Total recorded sales in USD. measure Revenue = SUM(Sales[Amount]) displayFolder: Finance formatString: $#,0The corresponding intended property edits are Description and DisplayFolder only; preserve existing objects and format string when scripting the real object from the model. In contrast, the following TMSL JSON is a scoped refresh command for an imaginary database and partition. It is an example to read, not execute:
{ "refresh": { "type": "full", "objects": [ { "database": "LAB_ONLY", "table": "Sales", "partition": "SalesImport" } ] }}A refresh reads data and processes the partition; it is not required for this description edit. Neither snippet has been parsed by a native engine.
Avoid destructive replacement
A JSON command is not automatically a safe property patch. CreateOrReplace can delete omitted read-write objects within its target scope. A model-level replacement containing only Sales can therefore remove other tables. Do not copy a partial definition into a replacement command. Preview generated scripts, check target identity and object scope, preserve rollback artifacts and require explicit authorization before deployment. An external tool’s ability to connect does not grant authorization. Do not connect to a shared XMLA endpoint for this lab.
Practice — select an interface
You need to list measures, review a description change in Git, and explain an administrative partition refresh. Assign TOM, TMDL or TMSL to each task; identify the action that could change stored data. Explain why a local file diff is not proof of XMLA write permission. Next: review the metadata change.
Documentation search extracts checked 2026-11-29. Installed versions and native execution NOT RUN.
- https://learn.microsoft.com/analysis-services/tom/introduction-to-the-tabular-object-model-tom-in-analysis-services-amo
- https://learn.microsoft.com/en-us/analysis-services/tmsl/tabular-model-scripting-language-tmsl-reference?view=azure-analysis-services-current
- https://learn.microsoft.com/en-us/analysis-services/tmsl/tmsl-reference-commands?view=power-bi-premium-current
- https://learn.microsoft.com/en-us/analysis-services/tmdl/tmdl-overview?view=sql-analysis-services-2025
- https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-tmdl-view
- https://learn.microsoft.com/en-us/power-bi/enterprise/service-premium-connect-tools/
- https://learn.microsoft.com/en-us/analysis-services/tmsl/createorreplace-command-tmsl?view=sql-analysis-services-2025
- https://learn.microsoft.com/en-us/analysis-services/tmdl/tmdl-reference-tabular-object?wt.mc_id=DP-MVP-5004989