-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathuse_dataflow_storage.py
More file actions
31 lines (24 loc) · 958 Bytes
/
Copy pathuse_dataflow_storage.py
File metadata and controls
31 lines (24 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""Demonstrates how to use the `DataflowStorageAccount` service."""
from pprint import pprint
from configparser import ConfigParser
from powerbi.client import PowerBiClient
# Initialize the Parser.
config = ConfigParser()
# Read the file.
config.read("config/config.ini")
# Get the specified credentials.
client_id = config.get("power_bi_api", "client_id")
redirect_uri = config.get("power_bi_api", "redirect_uri")
client_secret = config.get("power_bi_api", "client_secret")
# Initialize the Client.
power_bi_client = PowerBiClient(
client_id=client_id,
client_secret=client_secret,
scope=["https://analysis.windows.net/powerbi/api/.default"],
redirect_uri=redirect_uri,
credentials="config/power_bi_state.jsonc",
)
# Initialize the `DataflowStorageAccount` service.
dataflow_storage_service = power_bi_client.dataflow_storage_account()
# Refresh Users Permissions.
pprint(dataflow_storage_service.get_dataflow_storage_accounts())