AnalysisServices Azure

Azure Analysis backup Automation

This Blog will help to create backup file for Azure analysis database model.

We have used PowerShell to execute Analysis command which help to create backup file for AS model ,Please find the code below :-

$fulldate="_"+(get-date).ToString("ddMMyyyhhmmss")
#$fulldate
$MonYear=(get-date).date.AddMonths(-1).ToString("MMMyyy")+"/"
$ServerName1="<SERVERNAME>"
$ServerName2="<Servername>"
$Secure_String_Pwd = ConvertTo-SecureString "Pass@1234" -AsPlainText -Force
#$Secure_String_Pwd 
$cred = Get-AutomationPSCredential -Name 'aasautomationcred'
#$cred
$modellist = @("cubename1","cubename2")
$modellist
for ($i=0; $i -lt $modellist.Length; $i++) 
{
  $modelname=$modellist[$i]
  if($modelname -eq "cubename" -or $modelname -eq "cubename")
    {
    Backup-ASDatabase -Server $ServerName2 -Name $modelname  –backupfile ($MonYear+$modelname+$fulldate+".abf") -ApplyCompression  -FilePassword:$Secure_String_Pwd -Credential $cred -ErrorAction Stop 
    } 
  else
    {
    Backup-ASDatabase -Server $ServerName1 -Name $modelname  –backupfile ($MonYear+$modelname+$fulldate+".abf") -ApplyCompression -FilePassword:$Secure_String_Pwd -Credential $cred -ErrorAction Stop 
    }
}

5 thoughts on “Azure Analysis backup Automation

  1. Can I just say what a relief to uncover an individual who really understands what theyre talking about on the web. You certainly know how to bring a problem to light and make it important. More people ought to read this and understand this side of the story. I was surprised that you arent more popular given that you most certainly have the gift.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top