LINQ to extract object permission from SSAS

Yesterday one customer of mine encountered the issue described in KB933836 and posted also by Chris Webb.

UPDATE: you can use the SQL Server 2008 version of the Analysis Services Deployment Wizard to deploy a project to a SQL Server 2005 Analysis Services engine. The new version of the wizard supports a Retain roles and members setting.

The issue is that the deployment of a SSAS database always overwrite object permissions defined on database objects like cubes. The “keep existing roles” setting of deployment wizard does not preserve those information. I needed to solve the issue and I simply made a simple program that creates an XMLA file with object permissions that I need to restore after database deployment. I used LINQ and XML Literals in Visual Basic – I wrote a book about LINQ and I have to find a reason for this, but I really think that LINQ saved my time.

I will write a more complete article about this issue one day, may be… by now, if you have the same issue, you can contact me to get the code I wrote. If you don’t need it, look at the readability of LINQ in a case like this.

image 

If I will receive some request, I will consider to publish this simple tool.