Skip to content

Commit 294cded

Browse files
author
Aviat Cohen
committed
docs: add deploy command documentation and examples
1 parent a14137c commit 294cded

File tree

6 files changed

+297
-0
lines changed

6 files changed

+297
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: docs
2+
body: Add documentation for deploy command
3+
time: 2026-03-12T14:16:30.396559833Z
4+
custom:
5+
Author: aviatco
6+
AuthorLink: https://github.com/aviatco

docs/commands/fs/deploy.md

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

0 commit comments

Comments
 (0)