Skip to content

Commit 28dcac9

Browse files
aviatcoAviat Cohenayeshurun
authored
docs: deploy command docs (#188)
Co-authored-by: Aviat Cohen <aviatcohen@microsoft.com> Co-authored-by: Alon Yeshurun <98805507+ayeshurun@users.noreply.github.com>
1 parent a14137c commit 28dcac9

File tree

6 files changed

+284
-0
lines changed

6 files changed

+284
-0
lines changed

docs/commands/fs/deploy.md

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# `deploy` Command
2+
3+
The `deploy` command imports workspace items from a local source into a target Fabric workspace.
4+
5+
You can deploy:
6+
7+
- all items from the source workspace
8+
- specific folders that contain items
9+
- specific items
10+
11+
**Supported Types:**
12+
13+
- All Fabric workspace item types that support definition import (e.g., `.Notebook`, `.DataPipeline`, `.Report` )
14+
15+
**Usage:**
16+
17+
```
18+
fab deploy --config <config_file> [--target_env <environment>] [--params <parameters>] [--force]
19+
```
20+
21+
**Parameters:**
22+
23+
- `--config <file>`: Path to the deployment configuration YAML file. **Required**.
24+
- `--target_env, -tenv <env>`: Environment name used to select environment-specific settings from the configuration file and the parameter file (if present). Optional.
25+
- `--params, -P <params>`: JSON-formatted parameters provided to the deployment process at runtime. Optional.
26+
- `--force, -f`: Run the deployment without interactive confirmation prompts. Optional.
27+
28+
**Example:**
29+
30+
```
31+
fab deploy --config config.yml --target_env dev
32+
```
33+
34+
---
35+
36+
### Deployment Behavior
37+
38+
The scope of the deployment, its operations (e.g., publish, unpublish), and settings are defined entirely by the configurations set in a YAML file.
39+
40+
During execution, the command:
41+
42+
- publishes items found in the source into the target workspace
43+
- resolves dependencies between items automatically when logical IDs are present
44+
- unpublishes items from the target workspace that no longer exist in the source
45+
46+
By default, **both publish and unpublish operations are enabled and executed**.
47+
To disable either operation for a specific environment, it must be explicitly skipped in the configuration file.
48+
49+
The deployment to the Fabric workspaces is executed via the Fabric REST APIs.
50+
51+
---
52+
53+
### Configuration Behavior
54+
55+
- The configuration file controls what is published and unpublished.
56+
- Publish and unpublish operations are enabled by default.
57+
- Skipping publish or unpublish must be explicitly defined per environment.
58+
- Target Environment selection is resolved only when environment mappings are present in the configuration.
59+
- If `--target_env` is not specified, the configuration fields must not contain environment-mappings.
60+
61+
---
62+
63+
### Configuration File
64+
65+
#### Minimal Configuration (No Environment Mappings)
66+
67+
```yaml
68+
core:
69+
workspace_id: "12345678-1234-1234-1234-123456789abc"
70+
repository_directory: "."
71+
```
72+
73+
#### Configuration Fields
74+
75+
| Field | Description | Mandatory |
76+
|------|------------|-----------|
77+
| `core.workspace_id` | Target workspace ID (GUID). Takes precedence over `workspace`. | ✅ Yes |
78+
| `core.workspace` | Target workspace name. Alternative to `workspace_id`. | ❌ No |
79+
| `core.repository_directory` | Path to local directory containing item files. | ✅ Yes |
80+
| `core.item_types_in_scope` | List of item types included in deployment. | ❌ No |
81+
| `core.parameter` | Path to parameter file. | ❌ No |
82+
| `publish` | Controls publishing behavior. | ❌ No |
83+
| `unpublish` | Controls unpublishing behavior. | ❌ No |
84+
| `features` | Set feature flags. | ❌ No |
85+
| `constants` | Override constant values. | ❌ No |
86+
87+
Relative paths for `repository_directory` and `parameter` fields are resolved relative to the configuration file location.
88+
89+
---
90+
91+
### Publish and Unpublish Settings
92+
93+
#### Publish
94+
95+
```yaml
96+
publish:
97+
exclude_regex: "^DONT_DEPLOY.*" # Excludes items matching this pattern from publishing
98+
folder_exclude_regex: "^/legacy" # Excludes items under matching folders from publishing (requires feature flags)
99+
folder_path_to_include: # Publishes only the specified items under matching folder (requires feature flags)
100+
- /subfolder_1
101+
items_to_include: # Publishes only the specified items (requires feature flags)
102+
- "MainNotebook.Notebook"
103+
skip: # Skips publishing per environment
104+
dev: true
105+
test: false
106+
prod: false
107+
```
108+
109+
#### Unpublish
110+
111+
```yaml
112+
unpublish:
113+
exclude_regex: "^DEBUG.*" # Prevents matching items from being removed
114+
items_to_include: # Unpublishes only the specified items (requires feature flags)
115+
- "OldPipeline.DataPipeline"
116+
skip: # Skips unpublishing per environment
117+
dev: true
118+
test: false
119+
prod: false
120+
```
121+
122+
> **Note**
123+
> While selective deployment is supported, it is not recommended due to potential issues with dependency management. Use selective deployment options with caution.
124+
125+
---
126+
127+
### Parameter File
128+
129+
The parameter file enables environment‑specific transformations by applying targeted replacements within deployed content.
130+
131+
It can be used to:
132+
133+
- replace workspace and item identifiers
134+
- replace connection strings and URLs
135+
- update embedded values inside item definitions
136+
- parameterize environment-specific configuration values
137+
138+
The parameter file is optional and is applied only when specified in the configuration.
139+
140+
When deploying item files that were not created via Git Integration but instead exported (for example, using the Fabric CLI export command), parameterization should be used to resolve dependencies. Otherwise, items will reference the original item.
141+
142+
#### Example
143+
144+
```yaml
145+
find_replace:
146+
- find_value: "dev-connection-string"
147+
replace_value:
148+
dev: "dev-connection-string"
149+
test: "test-connection-string"
150+
prod: "prod-connection-string"
151+
```
152+
153+
#### Supported `replace_value` Variables
154+
155+
- `$workspace.$id` — resolves to the target workspace ID
156+
- `$items.<ItemType>.<ItemName>.$id` — resolves to the deployed item ID
157+
158+
Parameterization behavior follows the documented model described here:
159+
160+
https://microsoft.github.io/fabric-cicd/latest/how_to/parameterization
161+
162+
---
163+
164+
### More Examples
165+
166+
#### Deployment to a Specific Environment
167+
168+
```bash
169+
fab deploy --config config.yml --target_env prod
170+
```
171+
172+
#### Deployment with Runtime Parameters
173+
174+
```bash
175+
fab deploy --config config.yml --target_env test -P config_override='{"core":{"item_types_in_scope":["Notebook"]}}'
176+
```
177+
178+
---
179+
180+
### Preparing Source Content
181+
182+
#### Using Git Integration
183+
184+
If the workspace is connected to Git, clone the repository locally:
185+
186+
```bash
187+
git clone <git-repository-url>.git
188+
```
189+
190+
Use the cloned repository as the deployment source.
191+
192+
#### Using `fab export`
193+
194+
`fab export` exports one item at a time and does not include logical IDs.
195+
196+
```bash
197+
fab export ws.Workspace/MyDataPipeline.DataPipeline -o C:\Users\myuser
198+
```
199+
200+
---
201+
202+
### Additional Notes
203+
204+
- The deploy command can be applied to Fabric item files created via Git integration or using the `export` command (utilizes Get Item Definition API).
205+
- `fab deploy` does not require items to be created via Git integration prior to deployment; however, using Git integration is strongly recommended for dependency resolution with minimal parameterization.
206+
- Parameterization is optional and can be applied in any deployment scenario.
207+
208+
---
209+
210+
### Usfull links
211+
212+
- [Fabric cicd lib](https://microsoft.github.io/fabric-cicd/latest/)

docs/commands/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ It supports both Unix-style and Windows-style command names for file system oper
6565
| [`start`](./fs/start.md) | Start a resource |
6666
| [`stop`](./fs/stop.md) | Stop a resource |
6767
| [`unassign`](./fs/unassign.md) | Unassign a resource from a workspace |
68+
| [`deploy`](./fs/deploy.md) | Deploy Fabric workspace items from local source content into a target Microsoft Fabric workspace. |
6869

6970
#### [Table Management (table)](tables/index.md)
7071
Commands for working with tables in lakehouses, including operations like loading data, optimizing tables, and managing schemas.

docs/examples/folder_examples.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,29 @@ fab mv ws1.Workspace/source.Folder ws2.Workspace
173173
174174
*Result:* `ws2.Workspace/dest.Folder/source.Folder`
175175
176+
### Deploy Fabric workspace folders containing items
177+
178+
Deploy specific folders from local content using configuration files. This allows selective deployment of folder contents.
179+
180+
#### Deploy Specific Folders
181+
182+
Deploy only items within specific folders to target workspace.
183+
184+
```
185+
fab deploy --config config.yml -tenv dev -P config_override='{"publish": {"folders_to_include": ["Production", "Core"]}, "features": ["enable_include_folder", "enable_experimental_features"]}'
186+
```
187+
188+
#### Deploy with Folder Exclusions
189+
190+
Deploy workspace content while excluding specific folders.
191+
192+
```
193+
fab deploy --config config.yml -tenv prod -P config_override='{"publish": {"folder_exclude_regex": "^temp|^debug"}, "features": ["enable_exclude_folder", "enable_experimental_features"]}'
194+
```
195+
196+
!!! note "Configuration Options"
197+
All the configuration options shown above with `config_override` can also be defined directly in the configuration file instead of passing them as command-line overrides. The `config_override` examples are provided for demonstration and dynamic configuration purposes.
198+
176199
---
177200
178201
For managing folders within OneLake storage (e.g., `Lakehouse/Files`), see [OneLake Examples](./onelake_examples.md)

docs/examples/item_examples.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,41 @@ Import an item definition from a local directory into the workspace.
345345
fab import ws1.Workspace/nb1_imported.Notebook -i /tmp/exports/nb1.Notebook
346346
```
347347

348+
#### Deploy Items from Configuration
349+
350+
Deploy items from local workspace content to a target workspace using a configuration file.
351+
352+
```
353+
fab deploy --config config.yml -tenv dev
354+
```
355+
356+
#### Deploy Specific Item Types
357+
358+
Deploy only specific types of items using item_types_in_scope.
359+
360+
```
361+
fab deploy --config config.yml -tenv dev -P config_override='{"core": {"item_types_in_scope": ["Notebook", "DataPipeline"]}}'
362+
```
363+
364+
#### Deploy Specific Items
365+
366+
Deploy only specified items using items_to_include.
367+
368+
```
369+
fab deploy --config config.yml -tenv prod -P config_override='{"publish": {"items_to_include": ["MainNotebook.Notebook", "ProductionPipeline.DataPipeline"]}, "features": ["enable_items_to_include", "enable_experimental_features"]}'
370+
```
371+
372+
#### Deploy with Item Exclusions
373+
374+
Deploy items while excluding specific items or patterns.
375+
376+
```
377+
fab deploy --config config.yml -tenv dev -P config_override='{"publish": {"exclude_regex": "^(TEMP|DEBUG|TEST).*"}}'
378+
```
379+
380+
!!! note "Configuration Options"
381+
All the configuration options shown above with `config_override` can also be defined directly in the configuration file instead of passing them as command-line overrides. The `config_override` examples are provided for demonstration and dynamic configuration purposes.
382+
348383
### Start/Stop Mirrored Databases
349384

350385
#### Start Mirrored Database

docs/examples/workspace_examples.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,18 @@ fab export ws1.Workspace -o /ws1.Workspace/lh1.Lakehouse/Files
260260
fab export ws1.Workspace -o /ws1.Workspace/lh1.Lakehouse/Files -a
261261
```
262262

263+
### Deploy Workspace Items
264+
265+
Deploy workspace items from local source to target workspaces using configuration files.
266+
267+
#### Deploy Full Workspace
268+
269+
Deploy entire workspace content to a target workspace.
270+
271+
```
272+
fab deploy --config config.yml -tenv dev
273+
```
274+
263275
### Copy Workspace Items
264276
#### Copy Items Between Workspaces
265277

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ nav:
8181
- cd: commands/fs/cd.md
8282
- config: commands/config/index.md
8383
- cp (copy): commands/fs/cp.md
84+
- deploy: commands/fs/deploy.md
8485
- desc: commands/desc/index.md
8586
- export: commands/fs/export.md
8687
- exists: commands/fs/exists.md

0 commit comments

Comments
 (0)