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
}
}