Microsoft Docs

Deploying Analysis Services Solutions

This document provides a comprehensive guide to deploying SQL Server Analysis Services (SSAS) solutions. We will cover the different deployment methods, best practices, and common scenarios.

Introduction to SSAS Deployment

Deploying an Analysis Services solution involves taking a project developed in SQL Server Data Tools (SSDT) and making it available for users to query. This typically involves processing and configuring the deployed objects.

Deployment Methods

There are several ways to deploy SSAS solutions:

1. Deploying with SQL Server Data Tools (SSDT)

SSDT provides a seamless deployment experience directly from your Visual Studio solution.

  1. Right-click on the SSAS project in Solution Explorer.
  2. Select "Deploy" from the context menu.
  3. The deployment wizard will guide you through selecting the target server and any required configuration changes.

This method is ideal for initial development and testing phases.

2. Deploying with XMLA Scripts

XMLA scripts offer a powerful way to script the entire deployment process, including creating or altering databases, tables, dimensions, measures, and executing processing commands.

Here's a simplified example of an XMLA script to deploy a database:


<Batch xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
  <Create>
    <Database ID="MyNewDatabase" Name="My BI Solution" Visible="true" />
  </Create>
  <Alter>
    <ObjectDefinition>
      <Database ID="MyNewDatabase">
        <Name>My Deployed BI Solution</Name>
        <DataSource  xmlns="http://schemas.microsoft.com/analysisservices/2003/engine/DataSource">
          <ID>DataSource1</ID>
          <Name>SQL Server Source</Name>
          <ConnectionString>Provider=SQLNCLI11;Data Source=YourServerName;Initial Catalog=YourDatabaseName;Integrated Security=SSPI;</ConnectionString>
          <ImpersonationInfo>
            <ImpersonationMode>ImpersonateAccount</ImpersonationMode>
            <ImpersonatedAccount>Domain\ServiceAccount</ImpersonatedAccount>
          </ImpersonationInfo>
        </DataSource>
        <!-- Other object definitions like Cubes, Dimensions, etc. -->
      </Database>
    </ObjectDefinition>
  </Alter>
  <Process xmlns="http://schemas.microsoft.com/analysisservices/2003/engine/Process">
    <Object>
      <DatabaseID>MyNewDatabase</DatabaseID>
    </Object>
    <Type>Full</Type>
    <ErrorConfiguration>
      <KeyErrorAction>Continue</KeyErrorAction>
      <KeyErrorLimit>0</KeyErrorLimit>
      <KeyErrorLogFile>C:\SSAS\ErrorLog.log</KeyErrorLogFile>
    </ErrorConfiguration>
  </Process>
</Batch>
        

You can execute these scripts using tools like SQL Server Management Studio (SSMS) by connecting to the Analysis Services instance and opening a new Query window.

3. Deploying with PowerShell

The SSAS PowerShell module simplifies the automation of deployment and management tasks.

Ensure you have the SSAS PowerShell module installed. You can then use cmdlets like Deploy-ASDatabase.


# Connect to the SSAS server
$asServer = New-Object Microsoft.AnalysisServices.Tabular.Server
$asServer.Connect("YourServerName")

# Path to your deployed solution file (typically a .asdatabase file)
$solutionFile = "C:\Path\To\YourSolution.asdatabase"

# Deploy the solution
Deploy-ASDatabase -Server $asServer -Path $solutionFile -Overwrite
        

PowerShell is excellent for CI/CD pipelines.

Deployment Considerations

Configuration Settings

During deployment, you'll often need to update configuration settings, such as data source connection strings, which may differ between development, testing, and production environments.

SSDT allows you to define deployment configurations. You can also manage these settings via XMLA or AMO after deployment.

Processing

After deploying the database schema, the data needs to be loaded into the SSAS objects. This is done through processing.

Processing can be initiated via SSDT, SSMS, XMLA scripts, or PowerShell.

Tip: Schedule processing jobs using SQL Server Agent to keep your Analysis Services data up-to-date.

Permissions

Ensure appropriate security roles and permissions are configured on the deployed SSAS database to grant users access to the data.

Best Practices for Deployment

Troubleshooting Common Deployment Issues

Note: For granular control over deployment and processing, consider using AMO in your custom applications or scripts.

By following these guidelines, you can ensure a smooth and reliable deployment process for your SQL Server Analysis Services solutions.