Search code examples
azurepowershellssas-tabularazure-analysis-services

Backup Azure Analysis Services Tabular Model


Using below code to backup Azure Analysis Tabular Model:

Backup-ASDatabase -Server $ServerName -BackupFile $BkupFile -Name $CubeName -ApplyCompression -ErrorAction Stop

But get below issue: Backup-ASDatabase : This feature is not supported in AS Azure.

Above code snippet however works fine for On Prem Tabular model. Checked online for solutions and found below link, which suggests using Azure Automation account and PowerShell Workflow

https://gallery.technet.microsoft.com/scriptcenter/Azure-Analysis-Backup-a06df3ad#content

Get below issue, if I use the code from above link:

Cannot find the 'Backup-ASDatabase' command. If this command is defined as a workflow, ensure it is defined before the workflow that calls it. If it is a command intended to run directly within Windows PowerShell (or is not available on this system), place it in an InlineScript: 'InlineScript { Backup-ASDatabase }'

Tried enclosing the code in InlineScript but get the same issue. Can I get some leads or a simple work around to do this simple task of just backing up Azure Analysis Tabular Model.


Solution

  • Below code works, but the backup location needs to be an Azure Blob storage container. Also for locally running the PowerShell you might want to whitelist your Client IP address(your machine IP address) on the Azure portal.

    Backup-ASDatabase -Server $ServerName -Name $CubeName -ApplyCompression -ErrorAction Stop

    You need to configure your backup location as a one time activity on Azure Portal. No need to explicitly give the backup location path in above code snippet. It will auto backup the cube to the configured container location.