Posts From Category: VSTS

Build Tabular Models through hosted agent

Working with a modern BI setup it is important to ensure that continious deployment (build and release) is handled automatically using tools like Azure Devops or other similar tools.

On most projects i have been working we have utilized a self-hosted agent for these activites and therefore had a lot of control of what is installed once and then reused by the agent. This appraoch have been working great for a lot of situations. This have by quite some time been my preferred way of doing things when using Tabular Editor, mainly because the AMO libraries have not been available for download in any easy acessible way.

Recently i have been playing around with some scenarios to avoid installing the agent on hosted environments since a full-blown BI setup in azure does not really need any hosted machines. Due to this i have been investigating if i could get away with only using the hosted agent.

I have decided to download the latest version of the AMO library even with SSDT already installed on the host. This is simply because the hosted agent only have version of the TOM AMO libraries installed. The currently latest version of AMO library is

# Load security protocol to handle HTTPS connection to GitHub
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

# Load Github release details for Tabular Editor
$TabularEditor = Invoke-WebRequest -Uri "" | ConvertFrom-Json;

# Identify download path from for for download purposes
$TabularEditorDownloadPath = $TabularEditor.Assets | Where-Object { $ -eq "" }  | Select-Object @{N="DownloadPath";E={$_.browser_download_url }} 

# Download file to root of repository
$TabularEditorZip = join-path (get-location) ""
Invoke-WebRequest -Uri $TabularEditorDownloadPath.DownloadPath -OutFile $TabularEditorZip

#Unzip and delete archive
Expand-Archive -Path $TabularEditorZip -DestinationPath  (get-location).Path
Remove-Item $TabularEditorZip

# Install AMO package to Tabular Editor to run
# Make sure we have Nuget.exe
$nugetFolder = Join-Path $env:LOCALAPPDATA "Nuget"

$nugetExe = Join-Path $nugetFolder "Nuget.exe"

if (-not (Test-Path $nugetFolder)) {
    New-Item $nugetFolder -ItemType Directory

if (-not (Test-Path $nugetExe)) {
    $ProgressPreference = "SilentlyContinue"
    Invoke-WebRequest '' -OutFile $nugetExe

& $nugetExe update -self

# Download AMO Libraries
$nugetExe = [System.IO.Path]::Combine($Env:LOCALAPPDATA, "Nuget", "Nuget.exe")
& $nugetExe install Microsoft.AnalysisServices.retail.amd64 -OutputDirectory (get-location) -ExcludeVersion

# Move AMO DLL's to Tabular Editor for it to run
$AMOFilePath = Join-Path (get-location) "Microsoft.AnalysisServices.retail.amd64\lib\net45"
Move-Item -Path "$AMOFilePath\*" -Destination (get-location)

Read More