Microsoft Power BI
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: Microsoft Power BI Main Site
API Documentation Link
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 |