Deploy Azure Analysis Services models

This document provides guidance on deploying your Azure Analysis Services models to a server instance. Deployment is a critical step to make your tabular or multidimensional models available to end-users and applications.

Prerequisites

  • An Azure Analysis Services server instance must be created and running.
  • Permissions to deploy models to the server (e.g., Server administrator role).
  • Your Analysis Services project compiled into a deployable format (e.g., a BACPAC file or a solution file).

Deployment Methods

You can deploy your models using several methods, depending on your workflow and preference.

Using Visual Studio

Visual Studio with Analysis Services projects is the primary development environment. After developing your model, you can deploy it directly:

  1. Open your Analysis Services project in Visual Studio.
  2. Right-click on the project in Solution Explorer and select "Deploy".
  3. The "Analysis Services Deployment Wizard" will launch.
  4. Enter your server name.
  5. Select the database(s) to deploy.
  6. Review the deployment summary and click "Deploy".

Note: Ensure the correct server name and credentials are provided. You might need to configure deployment properties within your project settings.

Using PowerShell

PowerShell provides a scriptable way to automate deployments. You can use the `Deploy-ASDatabase` cmdlet from the Analysis Services PowerShell module.

# Install the SSAS PowerShell module if you haven't already
                # Install-Module -Name AnalysisServices -Scope CurrentUser

                Import-Module AnalysisServices

                $serverName = "your-aas-server.asazure.windows.net"
                $databaseName = "YourDatabaseName" # Optional, can deploy to existing or create new
                $modelPath = "C:\Path\To\Your\Model.asdatabase" # Path to your compiled model files

                # Deploy to a new or existing database
                Deploy-ASDatabase -Server $serverName -SourcePath $modelPath -DatabaseName $databaseName -Force

                # Or to deploy the entire solution
                # Deploy-AsSolution -Server $serverName -SourcePath "C:\Path\To\Your\Solution.asconfig"
                

Using Azure CLI

The Azure CLI can also be used for deployment, especially for managing Azure resources.

# Login to your Azure account
                az login

                # Deploy an Analysis Services model
                az aasmodel deploy --resource-group <resource-group-name> --server <aas-server-name> --data-file <path-to-bacpac-file> --target-database <database-name>
                

Tip: Use the Azure CLI for integration into CI/CD pipelines.

Using SQL Server Management Studio (SSMS)

SSMS allows you to connect to your Azure Analysis Services server and deploy databases.

  1. Open SSMS and connect to your Azure Analysis Services server.
  2. Right-click on the "Databases" folder and select "Restore Database".
  3. Choose "From file" and select your BACPAC file.
  4. Provide a database name and click "OK".

Alternatively, you can deploy an existing database:

  1. Connect to the server in SSMS.
  2. Right-click on the target database and select "Deploy Database".
  3. Follow the wizard to select the model files and deploy.

Deployment Considerations

  • Environments: Plan for different deployment environments (development, testing, production).
  • Permissions: Ensure the deployment principal has the necessary permissions on the target server.
  • Automation: For frequent deployments, consider using CI/CD pipelines with Azure DevOps or GitHub Actions.
  • Database State: Understand whether you are deploying a new database, updating an existing one, or overwriting it. The --Force flag in PowerShell, for example, will overwrite the existing database.
  • Model Size: For very large models, deployment time can be significant.

Troubleshooting

Common deployment issues include:

  • Connection Errors: Verify server name, firewall rules, and network connectivity.
  • Permission Denied: Ensure the account used for deployment has the required roles (e.g., Administrator) on the Analysis Services server.
  • Model Incompatibilities: Check for compatibility issues between the model schema and the target server version.
  • Resource Constraints: For large deployments, ensure the server has sufficient resources.

Refer to Troubleshooting Azure Analysis Services for more detailed solutions.