Microsoft Power BI
40 min
the microsoft power bi connector enables streamlined interactions with power bi services, allowing users to manage reports, datasets, and apps programmatically microsoft power bi is a leading business analytics service that delivers insights for data driven decision making the microsoft power bi connector for swimlane turbine enables users to automate the integration of data visualization and analytics into their security workflows by leveraging this connector, users can dynamically add data to power bi datasets, retrieve detailed reports, and manage datasets and tables directly from the swimlane platform, enhancing their ability to visualize and analyze security data in real time this connector ingests data from the microsoft power bi and integrates it with swimlane prerequisites to utilize the microsoft power bi connector for swimlane turbine, ensure you have the following prerequisites oauth2 refresh token authentication with these parameters url endpoint url for power bi api access client id application id registered in azure active directory client secret secret key generated for the application in azure active directory authentication flow for oauth2 refresh token oauth 2 0 refresh token grant, which requires a refresh token , tenant id , client id and client secret use this auth with accounts which have mfa enabled to generate a refresh token please follow the instructions below in step 3 of the above mentioned setup instructions, please provide a redirect uri and select the platform as 'web', before clicking on register at the the bottom proceed with the remaining steps to generate 'client id', tenant id and client secret go to api permissions → add a permission → apis my organization uses → power bi service add the permissions in delegated permissions the swimlane team will provide a python script and instructions on how to use the script to generate the refresh token recommended application permissions (feel free use custom permissions if you only use certain actions) app read all report readwrite all report read all dataset readwrite all dataset read all capabilities the microsoft power bi connector integration provides the following capabilities datasets post rows get app by id get apps get datasets get report by id get reports post dataset push datasets get tables update table schema datasets notes for more information on microsoft power bi is found at https //powerbi microsoft com/en in/ api documentation link https //learn microsoft com/en us/rest/api/power bi/ configurations ms graph power bi refresh token grant authenticates using refresh token configuration parameters parameter description type required url a url to the target host string required cl id the client id string required cl secret the client secret string required refresh token refresh token string optional scope the scope for the authentication array optional verify ssl verify ssl certificate boolean optional http proxy a proxy to route requests through string optional actions datasets post rows adds new data rows to a table in a specified dataset in microsoft power bi, requiring datasetid and tablename as path parameters endpoint url v1 0/myorg/datasets/{{datasetid}}/tables/{{tablename}}/rows method post input argument name type required description path parameters datasetid string required parameters for the datasets post rows action path parameters tablename string required parameters for the datasets post rows action rows array optional parameter for datasets post rows rows productid number optional unique identifier rows name string optional name of the resource rows category string optional parameter for datasets post rows rows iscompete boolean optional parameter for datasets post rows rows manufacturedon string optional parameter for datasets post rows input example {"json body" {"rows" \[{"productid" 1,"name" "adjustable race","category" "components","iscompete"\ true,"manufacturedon" "07/30/2014"},{"productid" 2,"name" "ll crankarm","category" "components","iscompete"\ true,"manufacturedon" "07/30/2014"},{"productid" 3,"name" "hl mountain frame silver","category" "bikes","iscompete"\ true,"manufacturedon" "07/30/2014"}]},"path parameters" {"datasetid" "cfafbeb1 8037 4d0c 896e a46fb27ff229","tablename" "product"}} output parameter type description status code number http status code of the response reason string response reason phrase output example {"status code" 200,"response headers" {},"reason" "ok","json body" {}} get app by id retrieves details of a specified microsoft power bi app using its unique appid endpoint url v1 0/myorg/apps/{{appid}} method get input argument name type required description path parameters appid string required parameters for the get app by id action input example {"path parameters" {"appid" "f089354e 8366 4e18 aea3 4cb4a3a50b48"}} output parameter type description status code number http status code of the response reason string response reason phrase id string unique identifier description string output field description name string name of the resource publishedby string output field publishedby lastupdate string date value output example {"status code" 200,"response headers" {},"reason" "ok","json body" {"id" "f089354e 8366 4e18 aea3 4cb4a3a50b48","description" "the finance app","name" "finance","publishedby" "bill","lastupdate" "2019 01 13t09 46 53 094+02 00"}} get apps retrieve a list of installed microsoft power bi apps available to the user endpoint url v1 0/myorg/apps method get output parameter type description status code number http status code of the response reason string response reason phrase value array value for the parameter value id string unique identifier value description string value for the parameter value name string name of the resource value publishedby string value for the parameter value lastupdate string value for the parameter output example {"status code" 200,"response headers" {},"reason" "ok","json body" {"value" \[{},{}]}} get datasets retrieve a list of datasets available in the user's microsoft power bi workspace endpoint url v1 0/myorg/datasets method get output parameter type description status code number http status code of the response reason string response reason phrase value array value for the parameter value id string unique identifier value name string name of the resource value addrowsapienabled boolean value for the parameter value configuredby string value for the parameter value isrefreshable boolean value for the parameter value iseffectiveidentityrequired boolean unique identifier value iseffectiveidentityrolesrequired boolean unique identifier value isonpremgatewayrequired boolean value for the parameter output example {"status code" 200,"response headers" {},"reason" "ok","json body" {"value" \[{}]}} get report by id retrieves a specific microsoft power bi report using the provided report id endpoint url v1 0/myorg/reports/{{reportid}} method get input argument name type required description path parameters reportid string required parameters for the get report by id action input example {"path parameters" {"reportid" "5b218778 e7a5 4d73 8187 f10824047715"}} output parameter type description status code number http status code of the response reason string response reason phrase datasetid string response data id string unique identifier name string name of the resource weburl string url endpoint for the request embedurl string url endpoint for the request output example {"status code" 200,"response headers" {},"reason" "ok","json body" {"datasetid" "cfafbeb1 8037 4d0c 896e a46fb27ff229","id" "5b218778 e7a5 4d73 8187 f10824047715","name" "salesmarketing","weburl" "https //app powerbi com//reports/5b218778 e7a5 4d73 8187 f10824047715","embedurl" "https //app powerbi com/reportembed?reportid=5b218778 e7a5 4d73 8187 f1082404771 "}} get reports retrieves a comprehensive list of power bi reports, including shared reports and those from shared apps endpoint url v1 0/myorg/reports method get output parameter type description status code number http status code of the response reason string response reason phrase value array value for the parameter value datasetid string response data value id string unique identifier value name string name of the resource value weburl string url endpoint for the request value embedurl string url endpoint for the request output example {"status code" 200,"response headers" {},"reason" "ok","json body" {"value" \[{}]}} post dataset creates a new dataset in microsoft power bi with specified 'name' and 'tables' structure provided in the json body endpoint url v1 0/myorg/datasets method post input argument name type required description parameters defaultretentionpolicy string optional parameters for the post dataset action name string optional name of the resource defaultmode string optional parameter for post dataset tables array optional parameter for post dataset tables name string optional name of the resource tables columns array optional parameter for post dataset tables columns name string optional name of the resource tables columns datatype string optional response data tables columns formatstring string optional parameter for post dataset input example {"parameters" {"defaultretentionpolicy" "basicfifo"},"json body" {"name" "salesmarketing","defaultmode" "push","tables" \[{"name" "product","columns" \[{"name" "productid","datatype" "int64"},{"name" "name","datatype" "string"},{"name" "category","datatype" "string"},{"name" "iscompete","datatype" "bool"},{"name" "manufacturedon","datatype" "datetime"},{"name" "sales","datatype" "int64","formatstring" "currency"}]}]}} output parameter type description status code number http status code of the response reason string response reason phrase id string unique identifier name string name of the resource defaultretentionpolicy string output field defaultretentionpolicy output example {"status code" 200,"response headers" {},"reason" "ok","json body" {"id" "cfafbeb1 8037 4d0c 896e a46fb27ff229","name" "salesmarketing","defaultretentionpolicy" "basicfifo"}} push datasets get tables retrieves a list of tables from a specified dataset in microsoft power bi, requiring the datasetid as a path parameter endpoint url v1 0/myorg/datasets/{{datasetid}}/tables method get input argument name type required description path parameters datasetid string required parameters for the push datasets get tables action input example {"path parameters" {"datasetid" "5b218778 e7a5 4d73 8187 f10824047715"}} output parameter type description status code number http status code of the response reason string response reason phrase output example {"status code" 200,"response headers" {},"reason" "ok","json body" {}} update table schema datasets updates the metadata and schema of a table in a specified dataset in microsoft power bi, requiring datasetid, tablename, columns, and name endpoint url v1 0/myorg/datasets/{{datasetid}}/tables/{{tablename}} method put input argument name type required description path parameters datasetid string required parameters for the update table schema datasets action path parameters tablename string required parameters for the update table schema datasets action columns object optional parameter for update table schema datasets name string optional name of the resource description string optional parameter for update table schema datasets ishidden boolean optional unique identifier measures object optional parameter for update table schema datasets rows object optional parameter for update table schema datasets rows id string optional unique identifier source object optional parameter for update table schema datasets source expression string optional parameter for update table schema datasets input example {"json body" {"columns" {},"name" "string","description" "string","ishidden"\ false,"measures" {},"rows" {"id" "string"},"source" {"expression" "string"}},"path parameters" {"datasetid" "5b218778 e7a5 4d73 8187 f10824047715","tablename" "product"}} output parameter type description status code number http status code of the response reason string response reason phrase output example {"status code" 200,"response headers" {},"reason" "ok","json body" {}} response headers header description example content type the media type of the resource application/json date the date and time at which the message was originated thu, 01 jan 2024 00 00 00 gmt