Forum Discussion

Art666's avatar
Art666
Frequent Visitor
1 year ago
Solved

Get all Dataset (Semantic Model) or Report Users via Semantic Link or Semantic Labs

Hi,

 

Has anyone the knowledge how to get all specific dataset or report users (who has access to) via python in semantic link or/and labs?

 

Thanks in advance for your help!

4 Replies

  • Hi. I'm not sure about running this with semantic link. However, you can get it with the PowerBi Rest API as an Admin (or the setting that allows service principals to use admin api).

    The admin API let's you run requests like:

    https://learn.microsoft.com/en-us/rest/api/power-bi/admin/datasets-get-datasets-as-admin

    You can get all datasets in the tenant. You can also run a request to get all the datasets in an specific workspace. Then if you want to check users at the dataset you can run:

    https://learn.microsoft.com/en-us/rest/api/power-bi/admin/datasets-get-dataset-users-as-admin

    That should give you the users and permission at dataset.

    You can do the same for reports, there are requests for that if you look up there.

     

    In order to make it simple you can use the SimplePBI python library that helps you with the power bi api: https://pypi.org/project/SimplePBI/

    You also check this blog post to get started with service principal to use the API: https://blog.ladataweb.com.ar/post/740398550344728576/seteo-powerbi-rest-api-por-primera-vez

     

    I hope that helps,

    • Art666's avatar
      Art666
      Frequent Visitor

      Thank You ibarrau!

      Indeed this is the option, fortunately i know it, but still hoping having it in semantic link somewhere - would be just more convienient to have it within all other data which is possible to get

      • ibarrau's avatar
        ibarrau
        Super User

        The API it's not that hard with simplepbi. Don't worry. Semantic Link will stay inside the workspace you are running the code. You can get datasets like:

        import sempy.fabric as fabric
        df_datasets = fabric.list_datasets()

        That will show you the datasets for the workspace. However, I'm not sure that's enough for getting users, reports and info from all tenant.

        Regards