Quickstart: Create and query an Azure Analysis Services model

This quickstart guides you through the process of creating an Azure Analysis Services instance, connecting to it with Visual Studio, and deploying a sample tabular model. You'll then query the model using SQL Server Management Studio (SSMS).

Step 1: Create an Azure Analysis Services instance

Before you can create a model, you need an Azure Analysis Services server instance. You can create one from the Azure portal.

  1. In the Azure portal, click Create a resource.
  2. Search for Analysis Services and select it.
  3. Click Create.
  4. Fill in the required details: Subscription, Resource Group, Server name, Location, and Pricing tier.
  5. Click Review + create, then Create.

Step 2: Connect to the server with Visual Studio

You'll use Visual Studio with the Analysis Services projects extension to create and deploy tabular models.

  1. Install Visual Studio (Community edition is sufficient).
  2. Install the Analysis Services Projects extension from the Visual Studio Marketplace.
  3. In Visual Studio, create a new project: File > New > Project.
  4. Search for Tabular Project and select it.
  5. Give your project a name and location, then click Create.
  6. In the Model options dialog, select Connect to existing and enter your Analysis Services server name created in Step 1. Choose DirectQuery for the Compatibility level.
  7. Click Create.

Step 3: Deploy a sample tabular model

For this quickstart, we'll deploy a pre-built sample model. You can download the SQL Server samples, which includes the AdventureWorksDW sample database.

  1. Once connected in Visual Studio, right-click on your project in Solution Explorer and select Add > Existing Project as Tabular Model.
  2. Browse to and select the AdventureWorksDW2019.abf file from the downloaded samples.
  3. Right-click on your project in Solution Explorer and select Deploy.
  4. In the deployment dialog, ensure your Analysis Services server is selected and click Deploy.

Step 4: Query the model with SQL Server Management Studio (SSMS)

Now, let's query the deployed model using SSMS.

  1. Download and install SQL Server Management Studio (SSMS).
  2. Open SSMS and connect to your Analysis Services server instance using the server name from Step 1.
  3. Right-click on the database (which will be the name of your deployed model, e.g., AdventureWorksDW2019) and select New Query > MDX.
  4. Enter a simple MDX query, for example:
    SELECT {[Measures].[Sales Amount]} ON COLUMNS,
        {[Dim Customer].[Country].[Country].MEMBERS} ON ROWS
    FROM [AdventureWorksDW2019]
  5. Click Execute. You should see sales amounts by country.
Tip: For more complex modeling and DAX queries, explore the full documentation and tutorials available for Azure Analysis Services.