Deploy Azure Analysis Services models
This article guides you through the process of deploying your Azure Analysis Services (Azure AS) models to an Azure Analysis Services server. You can deploy models from Visual Studio or using command-line tools.
Deploying from Visual Studio
Visual Studio with the Analysis Services projects extension provides a streamlined workflow for developing and deploying Analysis Services models. This is the recommended method for most developers.
- Open your project: Open your Azure Analysis Services project in Visual Studio.
-
Set the target server:
- In Solution Explorer, right-click on your project name.
- Select Properties.
- In the Project Properties dialog, under the Deployment tab, enter the fully qualified server name of your Azure Analysis Services server. This name typically looks like
asazure://westus.asazure.windows.net/yourservername.
- Build the project: Right-click on your project again and select Build. Ensure the build is successful.
-
Deploy the model:
- Right-click on your project in Solution Explorer.
- Select Deploy.
- The Deployment Wizard will appear. Confirm the target server and click Next.
- Click Deploy.
Important: Ensure your Azure Analysis Services server is running and you have the necessary permissions to connect to it.
Deploying using Tabular Editor (Recommended for advanced users)
Tabular Editor is a popular open-source tool for modeling Analysis Services tabular data. It offers a visual interface for managing your model and supports direct deployment.
- Download and install Tabular Editor: If you don't have it, download it from the official Tabular Editor GitHub repository.
-
Connect to your server:
- Launch Tabular Editor.
- Click File > Connect.
- Enter your Azure Analysis Services server name (e.g.,
asazure://westus.asazure.windows.net/yourservername). - Provide your Azure AD credentials or an access token if required.
-
Open your model: Once connected, you can open your existing model files (
.bim) or work directly on the deployed model. -
Deploy changes:
- Make your desired changes to the model.
- Click File > Save to Database.
- Review the changes in the prompt and confirm the deployment.
Deploying using Azure CLI
You can automate deployments using the Azure CLI with the az analysisServices commands.
First, ensure you have the Azure CLI installed and are logged into your Azure account:
az login
To deploy a model using the Azure CLI, you can use the az analysisServices dm add command (for Data Mining models) or more commonly, script the deployment using tools that can execute commands against your Analysis Services instance, such as PowerShell with the AMO library or through Azure DevOps pipelines.
A common scripting approach involves using the AMO (Analysis Management Objects) library. Here's a conceptual PowerShell example:
# Ensure you have the Microsoft.AnalysisServices.Tabular library installed
# Install-Module -Name SqlServer -Scope CurrentUser -Force
Import-Module SqlServer
$serverName = "asazure://westus.asazure.windows.net/yourservername"
$modelPath = "C:\path\to\your\model.bim" # Path to your JSON model file
# Connect to the Analysis Services server
$server = New-Object Microsoft.AnalysisServices.Tabular.Server
$server.ConnectionString = "Provider=MSOLAP;Data Source=$serverName"
$server.Connect()
# Deploy the model
$server.Deserialize( (Get-Content $modelPath -Raw) )
Write-Host "Model deployed successfully to $serverName"
$server.Disconnect()
Tip: For automated deployments in CI/CD pipelines, consider using Azure DevOps tasks or GitHub Actions that integrate with Analysis Services.
Permissions
To deploy models, you need appropriate permissions on the Azure Analysis Services server. Typically, the server administrator role has the necessary privileges. If you are not an administrator, ensure you have been granted the Database owner or Database creator role on the target database.
Refer to Security in Azure Analysis Services for more details on roles and permissions.