forked from RuiRomano/pbip-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.py
More file actions
41 lines (32 loc) · 1.36 KB
/
deploy.py
File metadata and controls
41 lines (32 loc) · 1.36 KB
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
32
33
34
35
36
37
38
39
40
41
# Install fabric-cicd: https://microsoft.github.io/fabric-cicd/
from azure.identity import InteractiveBrowserCredential, ClientSecretCredential
from fabric_cicd import FabricWorkspace, publish_all_items, change_log_level
import argparse
import os
#change_log_level("DEBUG")
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--spn-auth", default = False)
parser.add_argument("--workspace", default = "PBIP Demo")
parser.add_argument("--environment", default = "DEV")
parser.add_argument("--src", default = ".\\src")
args = parser.parse_args()
spn_auth = args.spn_auth
workspace_name = args.workspace
src_path = args.src
environment = args.environment
# Authentication (SPN or Interactive)
if (not spn_auth):
credential = InteractiveBrowserCredential()
else:
client_id = os.getenv("FABRIC_CLIENT_ID")
client_secret = os.getenv("FABRIC_CLIENT_SECRET")
tenant_id = os.getenv("FABRIC_TENANT_ID")
credential = ClientSecretCredential(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)
target_workspace = FabricWorkspace(
workspace_name = workspace_name,
environment = environment,
repository_directory = src_path,
item_type_in_scope = ["SemanticModel", "Report"],
token_credential = credential,
)
publish_all_items(fabric_workspace_obj = target_workspace)