4

Semantic model security

Please include the possibility to add row filters to tabular roles. Currently we have to add this manually after each deployment.

Example powershell code:

 

[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")

# SSAS server name variable
$SSASServerName = ".................."

# Connect
$SSASServer = New-Object Microsoft.AnalysisServices.Server
$SSASServer.Connect($SSASServerName)

# Navigate
$database = $SSASServer.Databases.GetByName(".............")
$role = $database.Model.Roles.Item("Sales")

# Create TablePermission
$tableName = "CostCenter"

$perm = $role.TablePermissions[$tableName]
if (-not $perm) {
$perm = New-Object Microsoft.AnalysisServices.Tabular.TablePermission
$perm.Table = $perm.Model.Tables[$tableName]
$role.TablePermissions.Add( $perm )
}
$filter = $tableName + '[Department] = "Sales"';
$perm.FilterExpression = $filter

# Save
$database.Model.SaveChanges()

0 comments

Please sign in to leave a comment.