具有自动备份功能的Azure Analytics数据库

时间:2019-07-11 14:43:43

标签: azure powershell azure-automation azure-analysis-services azure-analytics

powershell用于自动备份AAS实例。 该实例具有多因素身份验证,我认为是问题所在。

enter image description here

Powershell:

 $TenantId = "TenentID"  
 $Cred = Get-AutomationPSCredential -Name 'SSASModelBackup'
 $Server = "ServerName" 
 $RolloutEnvironment = "location.asazure.windows.net" 
 $ResourceGroup = "ReourceGroupName"

 #Create Credentials to convertToSecureString
 $applicationId = "applicationId " 
 $securePassword = "securePassword " | ConvertTo-SecureString -AsPlainText -Force $Credential = New-Object
-TypeName System.Management.Automation.PSCredential -ArgumentList $applicationId, $securePassword



#Define the list of AAS databases  
$asDBs = @('database1','database2') 
Write-Output "Logging in to Azure..."   

#Add-AzureAnalysisServicesAccount -Credential $Credential -ServicePrincipal -TenantId $TenantId -RolloutEnvironment $RolloutEnvironment
ForEach($db in $asDBs)
 {
  Write-Output "Starting Backup..."
   Backup-ASDatabase `
  –backupfile ($db +"." + (Get-Date).ToString("ddMMyyyy") + ".abf") `
  –name $db `
  -server $Server `
  -Credential $Cred
  Write-Output "Backup Completed!" 
 }

1 个答案:

答案 0 :(得分:0)

您正确地认为问题出在多因素身份验证上。由于多重因素的关键是需要与诸如手机之类的辅助来源进行交互,因此无法自动执行该过程。

我建议您考虑使用service principle authentication来进行备份。通过对服务器使用服务原则,您可以使自动化任务在没有两方面因素的情况下运行,同时将安全风险降到最低。