未加星标

Use SQL Server RLS with SSAS and Power BI

字体大小 | |
[数据库(mssql) 所属分类 数据库(mssql) | 发布者 店小二05 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏

One of the questions I get regularly nowthat SQL Server supports RLS is how can toleverage this withSSAS. What many don’t know is that SSAS already supports this, even for Direct Query mode. So in this case you could have something like the following architecture: Dashboards and reports in Power BI that connect to an on premise SSAS server running DirectQuery mode connecting to SQL Server. All with the same username flowing from Power BI all the way down to SQL Server.

Let’s see how this works in SSAS, the Power BI and gateway part work as usual, no changes are needed there. The example belowis using Tabular DirectQuery but the same works for Multidimensional ROLAP.

I have this simple model with just 1 table set to DirectQuery mode:


Use SQL Server RLS with SSAS and Power BI

I am using the service account to connect to the data source (go to Existing connections, Edit Datasouce, Impersonations to get this dialog)


Use SQL Server RLS with SSAS and Power BI
(By the way you should never use the service account as impersonation setting in any production environment, I just use it here as I am lazy
Use SQL Server RLS with SSAS and Power BI
)

Now if I connect to this model with Excel and run profiler on SQL Server we can see the user that is running the queries to SQL Server and logging into SQL using the service account SSAS is running under:


Use SQL Server RLS with SSAS and Power BI

Now instead of the Service AccountI want to use the credentials of the user who is connecting to my model and use that toconnect to the SQL database. You cannot do this in the SSDT UI. Instead I publish the model to my server and open the Connection Dialog in SSMS:


Use SQL Server RLS with SSAS and Power BI

Again this is set to impersonate the service account:


Use SQL Server RLS with SSAS and Power BI

Clicking there it will give me a new option that I didn’t have in SSDT that allows me to use the credentials of the current user:


Use SQL Server RLS with SSAS and Power BI

I press OK and connect again with Excel to my model, now I will be able to see that my username is being used to connect to SQL Server:


Use SQL Server RLS with SSAS and Power BI

and that’s it, now SSAS passes on the credentials of the current user. If you have RLS configured at your SQL Server SQL database it will now only return the rows approved for this user. This option works for both Multi dimensional and Tabular.

Of course passing along credentials between machines can also complicate matters, in my scenario things are easy as I have all services on a single box but in a real world scenario SSAS and the SQL database system will not be on the same machine. In those cases you will need to configure Kerberos delegation between the two machines. Below you can find multiple blog post of SSAS andsimilar services that should give you a starting point on how to configure this:

https://msdn.microsoft.com/en-us/library/dn194199.aspx

http://sqlmag.com/sql-server-reporting-services/implement-kerberos-delegation-ssrs

https://shuggill.wordpress.com/2015/03/06/configuring-sql-server-kerberos-for-double-hop-authentication/

本文数据库(mssql)相关术语:熊片数据库 mssql数据库 oracle数据库 pubmed数据库 access数据库 万方数据库

主题: SQLSASSQL ServerExcel
分页:12
转载请注明
本文标题:Use SQL Server RLS with SSAS and Power BI
本站链接:http://www.codesec.net/view/483033.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 数据库(mssql) | 评论(0) | 阅读(41)