I have set the EffectiveUserName to show in the PowerBI logs correctly, and the on premise Power BI Gateway is using ENT\SQL_Analysis account that is a member of the Server Administrators on Analysis Server. However the Flight Record log is showing that the Power BI reports from the Power BI service are accessing the SSAS Analysis services multidimensional cube using "ENT\SQL_Analysis". This is an issue as the dynamic role security using UserName() , MDX command is only finding "ENT\SQL_Analysis" and NOT the actual user's AD account. Now their AD acccount would be Domain\Username. e.g EU\ELu however their effective user name is for example. Elaine.Lu@Company.com
So the issues are
1. Access to the cube by the Analysis server is always the Server admin account ( windows domain account)
2. Effective User Name is NOT the same as AD Username so , MDX command Username() needs to return the AD account name and not effective user name.
3. Dynamic security is effectively being made ineffective due to points 1 and 2. Ask "Guy in a Cube" , Adam Saxton, how to get dynamic roles using AD accounts on SSAS cubes working with the apparent configuration and limitations of Power BI Gateway.