Microsoft Developer Network

Database Roles

This document details the management and configuration of database roles within SQL Server Analysis Services (SSAS). Database roles are fundamental to controlling access to data and objects within an Analysis Services database.

Understanding Database Roles

Database roles in Analysis Services provide a flexible way to grant permissions to users and groups. Instead of assigning permissions directly to individual users, you can create roles, assign permissions to these roles, and then add users or Windows groups to the roles.

Key Concepts

Creating and Managing Database Roles

You can create and manage database roles using SQL Server Management Studio (SSMS) or programmatically using AMO (Analysis Management Objects) or XMLA (XML for Analysis).

Using SQL Server Management Studio (SSMS)

  1. Connect to your Analysis Services instance in SSMS.
  2. Navigate to the specific Analysis Services database.
  3. Right-click on the Roles folder and select New Role....
  4. In the Role Editor dialog:
    • General Page: Define the role name and description.
    • Membership Page: Add users or Windows groups to the role.
    • Permissions Page: Grant specific database permissions.
  5. Click OK to save the role.

Permissions Available

The following table lists common permissions that can be assigned to database roles:

Permission Description
Read Data Allows users to query data and metadata from the database.
Read Definition Allows users to view the structure and metadata of objects (e.g., cubes, dimensions, measures).
Read All Data Grants full read access to all data within the database.
Read All Definitions Grants full read access to all object definitions.
Administrative Grants full control over the database, including managing roles and other administrative tasks.
Create and Alter/Drop All Objects Allows users to create, modify, and delete all objects within the database.

Best Practices

Note:

Database roles are distinct from server roles. Server roles control administrative access to the Analysis Services instance itself, while database roles control access to individual Analysis Services databases.

Important Considerations:

When assigning permissions, remember that Read Data and Read Definition are often granted together for users to effectively query and understand the data.

Example Scenario

Consider a scenario where you have a sales department that needs to view sales data but not modify it. You would:

  1. Create a Windows group named "SALES\SalesUsers".
  2. Create an Analysis Services database role named "SalesReadOnly".
  3. Grant "Read Data" and "Read Definition" permissions to the "SalesReadOnly" role.
  4. Add the "SALES\SalesUsers" Windows group to the "SalesReadOnly" role membership.

This ensures that all members of the "SALES\SalesUsers" group can access and query the sales data in the Analysis Services database.

Further Reading