Skip to content

Commit 8602eb5

Browse files
committed
Add utility scripts documentation for managing Microsoft Fabric resources
1 parent 1496379 commit 8602eb5

2 files changed

Lines changed: 169 additions & 1 deletion

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ Follow these steps to deploy the solution to your own Azure subscription:
8585

8686
| [![GitHub Codespaces](https://img.shields.io/badge/GitHub_Codespaces-Open-grey?style=flat&labelColor=grey&message=Open&color=blue&logo=github)](https://codespaces.new/microsoft/real-time-intelligence-operations-solution-accelerator) | [![Visual Studio Code Dev Containers](https://img.shields.io/badge/Visual_Studio_Code_Dev_Container-Open-gray?style=flat&labelColor=grey&message=Open&color=blue)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/real-time-intelligence-operations-solution-accelerator) | [![Visual Studio Code Web](https://img.shields.io/badge/Visual_Studio_Code_Web-Open-gray?style=flat&labelColor=grey&message=Open&color=blue)](https://vscode.dev/github/microsoft/real-time-intelligence-operations-solution-accelerator) | [![Azure Cloud Shell](https://img.shields.io/badge/Azure_Cloud_Shell-Open-grey?style=flat&labelColor=grey&message=Open&color=blue)](https://portal.azure.com/#cloudshell/) |
8787
|---|---|---|---|
88-
| | | |
8988

9089
**One-command deployment** - Deploy everything with [Azure Developer CLI](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd) and [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) (check [prerquisites](./docs/DeploymentGuide.md#prerequisites)):
9190

infra/scripts/utils/README.md

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# Utility Scripts
2+
3+
This folder contains utility scripts for managing Microsoft Fabric resources and automating common tasks in the Real-Time Intelligence Operations solution.
4+
5+
## Table of Contents
6+
7+
- [Utility Scripts](#utility-scripts)
8+
- [Table of Contents](#table-of-contents)
9+
- [Get-FabricActivatorDefinition.ps1](#get-fabricactivatordefinitionps1)
10+
- [Get-FabricEventstreamDefinition.ps1](#get-fabriceventstreamdefinitionps1)
11+
- [Get-FabricRealTimeDashboardDefinition.ps1](#get-fabricrealtimedashboarddefinitionps1)
12+
- [Run-FabricJsonTokenizer.ps1](#run-fabricjsontokenizerps1)
13+
- [Run-PythonScript.ps1](#run-pythonscriptps1)
14+
15+
## Get-FabricActivatorDefinition.ps1
16+
Retrieves and decodes Microsoft Fabric Activator (Reflex) definitions using the Fabric REST API.
17+
18+
**Purpose:** Download activator configurations including entities and triggers for backup or deployment purposes.
19+
20+
**Required Parameters:**
21+
- `-WorkspaceId`: GUID of the Fabric workspace containing the activator
22+
- `-ReflexId`: GUID of the activator (reflex) to retrieve
23+
24+
**Optional Parameters:**
25+
- `-FolderPath`: Path to save decoded definition files (default: `src/activator` relative to repository root)
26+
- `-Format`: Format parameter for the activator definition (as supported by the API)
27+
- `-SkipTokenization`: Skip automatic tokenization of JSON files after creation (default: tokenization is performed)
28+
29+
**Default Behavior:** Saves files to `src/activator` folder and automatically tokenizes the resulting JSON files.
30+
31+
**Examples:**
32+
```powershell
33+
# Basic usage with default folder and tokenization
34+
.\Get-FabricActivatorDefinition.ps1 -WorkspaceId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -ReflexId "bbbbcccc-1111-dddd-2222-eeee3333ffff"
35+
36+
# Custom folder path
37+
.\Get-FabricActivatorDefinition.ps1 -WorkspaceId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -ReflexId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -FolderPath "C:\temp\activator"
38+
39+
# Skip tokenization
40+
.\Get-FabricActivatorDefinition.ps1 -WorkspaceId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -ReflexId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -SkipTokenization
41+
```
42+
43+
## Get-FabricEventstreamDefinition.ps1
44+
Retrieves and decodes Microsoft Fabric Eventstream definitions using the Fabric REST API.
45+
46+
**Purpose:** Download eventstream configurations including sources, destinations, and operators.
47+
48+
**Required Parameters:**
49+
- `-WorkspaceId`: GUID of the Fabric workspace containing the eventstream
50+
- `-EventstreamId`: GUID of the eventstream to retrieve
51+
52+
**Optional Parameters:**
53+
- `-FolderPath`: Path to save decoded definition files (default: `src/eventstream` relative to repository root)
54+
- `-Format`: Format parameter for the eventstream definition (as supported by the API)
55+
- `-SkipTokenization`: Skip automatic tokenization of JSON files after creation (default: tokenization is performed)
56+
57+
**Default Behavior:** Saves files to `src/eventstream` folder and automatically tokenizes the resulting JSON files.
58+
59+
**Examples:**
60+
```powershell
61+
# Basic usage with default folder and tokenization
62+
.\Get-FabricEventstreamDefinition.ps1 -WorkspaceId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -EventstreamId "bbbbcccc-1111-dddd-2222-eeee3333ffff"
63+
64+
# Custom folder path
65+
.\Get-FabricEventstreamDefinition.ps1 -WorkspaceId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -EventstreamId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -FolderPath "C:\temp\eventstream"
66+
67+
# Skip tokenization
68+
.\Get-FabricEventstreamDefinition.ps1 -WorkspaceId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -EventstreamId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -SkipTokenization
69+
```
70+
71+
## Get-FabricRealTimeDashboardDefinition.ps1
72+
Retrieves and decodes Microsoft Fabric Real-Time Dashboard (KQL Dashboard) definitions using the Fabric REST API.
73+
74+
**Purpose:** Download dashboard configurations including queries, parameters, and visualization tiles.
75+
76+
**Required Parameters:**
77+
- `-WorkspaceId`: GUID of the Fabric workspace containing the KQL dashboard
78+
- `-KqlDashboardId`: GUID of the KQL dashboard to retrieve
79+
80+
**Optional Parameters:**
81+
- `-FolderPath`: Path to save decoded definition files (default: `src/realTimeDashboard` relative to repository root)
82+
- `-Format`: Format parameter for the KQL dashboard definition (as supported by the API)
83+
- `-SkipTokenization`: Skip automatic tokenization of JSON files after creation (default: tokenization is performed)
84+
85+
**Default Behavior:** Saves files to `src/realTimeDashboard` folder and automatically tokenizes the resulting JSON files.
86+
87+
**Examples:**
88+
```powershell
89+
# Basic usage with default folder and tokenization
90+
.\Get-FabricRealTimeDashboardDefinition.ps1 -WorkspaceId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -KqlDashboardId "bbbbcccc-1111-dddd-2222-eeee3333ffff"
91+
92+
# Custom folder path
93+
.\Get-FabricRealTimeDashboardDefinition.ps1 -WorkspaceId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -KqlDashboardId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -FolderPath "C:\temp\dashboard"
94+
95+
# Skip tokenization
96+
.\Get-FabricRealTimeDashboardDefinition.ps1 -WorkspaceId "aaaabbbb-0000-cccc-1111-dddd2222eeee" -KqlDashboardId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -SkipTokenization
97+
```
98+
99+
## Run-FabricJsonTokenizer.ps1
100+
Processes JSON configuration files and replaces specific values with standardized tokens for deployment automation.
101+
102+
**Purpose:** Tokenize Fabric resource definitions to make them reusable across different environments.
103+
104+
**Required Parameters:**
105+
- `-SchemaType`: The schema type to process (valid values: `Activator`, `Eventstream`, `RealTimeDashboard`)
106+
107+
**Optional Parameters:**
108+
- `-JsonFilePath`: Path to the JSON file to tokenize (default: calculated based on SchemaType)
109+
- `-OutputPath`: Output path for the tokenized JSON (default: overwrites the original file)
110+
- `-DryRun`: Shows what would be changed without modifying files (default: false)
111+
- `-SaveTokenMap`: Creates a separate token mapping file alongside the tokenized JSON (default: false)
112+
113+
**Default Behavior:**
114+
- Activator: Processes `ReflexEntities.json` from `src/activator/`
115+
- Eventstream: Processes `eventstream.json` from `src/eventstream/`
116+
- RealTimeDashboard: Processes `RealTimeDashboard.json` from `src/realTimeDashboard/`
117+
118+
**Examples:**
119+
```powershell
120+
# Basic usage - tokenize eventstream with default settings
121+
.\Run-FabricJsonTokenizer.ps1 -SchemaType Eventstream
122+
123+
# Dry run to preview changes
124+
.\Run-FabricJsonTokenizer.ps1 -SchemaType Activator -DryRun
125+
126+
# Save token mapping file
127+
.\Run-FabricJsonTokenizer.ps1 -SchemaType RealTimeDashboard -SaveTokenMap
128+
129+
# Custom output path
130+
.\Run-FabricJsonTokenizer.ps1 -SchemaType Activator -OutputPath "ReflexEntities_tokenized.json"
131+
132+
# Custom input file
133+
.\Run-FabricJsonTokenizer.ps1 -SchemaType Eventstream -JsonFilePath "C:\custom\eventstream.json"
134+
```
135+
136+
## Run-PythonScript.ps1
137+
Unified script to execute Python scripts with proper environment management.
138+
139+
**Purpose:** Execute Python scripts with automatic virtual environment setup and dependency management.
140+
141+
**Required Parameters:**
142+
- `-ScriptPath`: Relative path to the Python script to execute (relative to repository root)
143+
144+
**Optional Parameters:**
145+
- `-ScriptArguments`: Array of arguments to pass to the Python script (default: empty array)
146+
- `-SkipPythonVirtualEnvironment`: Use system Python directly instead of creating virtual environment (default: false)
147+
- `-SkipPythonDependencies`: Skip installing Python dependencies (default: false, assumes pre-installed)
148+
- `-SkipPipUpgrade`: Skip upgrading pip to latest version (default: false)
149+
- `-RequirementsPath`: Path to requirements.txt file (default: repository root `requirements.txt`)
150+
151+
**Default Behavior:** Creates a virtual environment, upgrades pip, installs dependencies from `requirements.txt`, then executes the specified Python script.
152+
153+
**Examples:**
154+
```powershell
155+
# Basic usage with full environment setup
156+
.\Run-PythonScript.ps1 -ScriptPath "infra/scripts/fabric/deploy_fabric_rti.py"
157+
158+
# Skip virtual environment and use system Python
159+
.\Run-PythonScript.ps1 -ScriptPath "infra/scripts/fabric/deploy_fabric_rti.py" -SkipPythonVirtualEnvironment
160+
161+
# Skip dependency installation (assume pre-installed)
162+
.\Run-PythonScript.ps1 -ScriptPath "infra/scripts/fabric/delete_fabric_rti.py" -SkipPythonDependencies
163+
164+
# Pass arguments to the Python script
165+
.\Run-PythonScript.ps1 -ScriptPath "infra/scripts/fabric/deploy_fabric_rti.py" -ScriptArguments @("--verbose", "--config", "config.json")
166+
167+
# Use custom requirements file
168+
.\Run-PythonScript.ps1 -ScriptPath "src/sample_data.py" -RequirementsPath "src/requirements_basics.txt"
169+
```

0 commit comments

Comments
 (0)