Continuous integration and Deploy SSAS tabular to Azure Analysis Services

∥☆過路亽.° 提交于 2020-03-02 12:16:50

问题


I am trying to deploy SSAS Tabular model to Azure Analysis Server through MS Build and Release process.

I am able to successfully execute Invoke-ProcessASDatabase. But I am having problem with Deploying new objects to the Azure Server.

I am using Command Line to deploy the tabular model using below command

"C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\Microsoft.AnalysisServices.Deployment.exe"

and it fails with error -

Authentication failed: User ID and Password are required when user interface is not available.

I don't see a way how I can provide credentials in my command line task.


回答1:


Even I was trying to automate model deployment.

Here is the power shell script I wrote. Hope this helps.

$msBuildPath = Get-MSBuildToPath
$Microsoft_AnalysisServices_Deployment_Exe_Path = Get-Microsoft_AnalysisServices_Deployment_Exe_Path

# BUild smproj 
& $msBuildPath $projPath "/p:Configuration=validation" /t:Build

Get-ChildItem $binPath | Copy -Destination $workingFolder -Recurse

$secureStringRecreated = ConvertTo-SecureString -String $AnalysisServerPassword -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($AnalysisServerUserName, $secureStringRecreated)
#$plainText = $cred.GetNetworkCredential().Password

#region begin Update Model.deploymenttargets
# Read Model.deploymenttargets
[xml]$deploymenttargets = Get-Content -Path  $deploymenttargetsFilePath

$deploymenttargets.DeploymentTarget.Database = $AnalysisDatabase
$deploymenttargets.DeploymentTarget.Server = $AnalysisServer
$deploymenttargets.DeploymentTarget.ConnectionString = "DataSource=$AnalysisServer;Timeout=0;UID=$AnalysisServerUserName;Password=$AnalysisServerPassword;"
$deploymenttargets.Save($deploymenttargetsFilePath);
#endregion

#region begin Update Model.deploymentoptions
# Read Model.deploymentoptions
[xml]$deploymentoptions = Get-Content -Path  $deploymentoptionsFilePath

# Update ProcessingOption to DoNotProcess otherwise correct xmla file wont be generated.
$deploymentoptions.Deploymentoptions.ProcessingOption = 'DoNotProcess'
$deploymentoptions.Deploymentoptions.TransactionalDeployment = 'false'
$deploymentoptions.Save($deploymentoptionsFilePath);
#endregion

# Create xmla deployment file.
& $Microsoft_AnalysisServices_Deployment_Exe_Path $asdatabaseFilePath  /s:$logFilePath  /o:$xmlaFilePath

#region begin Update .xmla
#Add passowrd in .xmla file.
$xmladata = Get-Content -Path $xmlaFilePath | ConvertFrom-Json

foreach ($ds in $xmladata.createOrReplace.database.model.dataSources){
    $ds.Credential.AuthenticationKind = 'Windows'
    $ds.Credential.Username = $AnalysisServerUserName

    #Add password property to the object.
    $ds.credential | Add-Member -NotePropertyName Password -NotePropertyValue $AnalysisServerPassword
}

$xmladata | ConvertTo-Json -depth 100 | Out-File $xmlaFilePath
#endregion

#Deploy model xmla.
Invoke-ASCmd -InputFile $xmlaFilePath -Server $AnalysisServer -Credential $cred


来源:https://stackoverflow.com/questions/52657565/continuous-integration-and-deploy-ssas-tabular-to-azure-analysis-services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!