Continuous Deployment of Azure Analysis Services Cubes – Part 1

With Tabular Editor from Daniel Otykier, you can easily deploy tabular models to different stages. This Blog post covers how to do that and how to manage the connection which points to the correct stage. The second part will cover, how to do that with a SQL Authenticated user.
This blog post follows this series: https://tabulareditor.github.io/2019/10/08/DevOps3.html

Firstly, you need a pipeline with three steps: Download the portable version of tabular editor, the preparing of the release which will deployed, and the final deployment. The cube uses an OAuth connection which also must be maintained in the last step.

The first step downloads the Tabular Editor and extracts the content to the environment:

# Download URL for Tabular Editor portable:
$TabularEditorUrl = "https://github.com/otykier/TabularEditor/releases/download/2.12.4/TabularEditor.Portable.zip" 

# Download destination (root of PowerShell script execution path):
$DownloadDestination = join-path (get-location) "TabularEditor.zip"

# Download from GitHub:
Invoke-WebRequest -Uri $TabularEditorUrl -OutFile $DownloadDestination

# Unzip Tabular Editor portable, and then delete the zip file:
Expand-Archive -Path $DownloadDestination -DestinationPath (get-location).Path
Remove-Item $DownloadDestination

The second step copies the BIM file and replaces the connection. Normally you have different branches, but in this case it is easier. The connection from the BIM file points to the DEV SQL database, the replacement points the cube to the testing database.

Copy-Item "_cube/cube/cube/Model.bim" -Destination "_cube/cube/cube/Test.bim" -Force

(Get-Content "_cube/cube/cube/Test.bim") -replace '"server": "sqlpl001.database.windows.net",', '"server": "sqlpl002.database.windows.net",' | Set-Content "_cube/cube/cube/Test.bim"

The last step deploys the cube to the testing environment. The password of the deployment user is stored inside a variable and can get from KeyVault (https://www.flip-design.de/?p=1100 )

TabularEditor.exe _cube\cube\cube\Test.bim  -D asazure://eastus.asazure.windows.net/aspltest Cube -L philipp@plenz.onmicrosoft.com $(password) -O

But when you want to refresh the cube to get new data, you get an error. The reason why is, that you OAuth connection user doesn’t have actual credential information:

You can fix it, by refreshing the credentials. But you must be aware of, that your credentials will expire.

After that, and when you refresh the cube instantly, the lease time will be updated.