Optional Features¶
fabric-cicd has an expected default flow; however, there will always be cases where overriding default behavior is required.
Feature Flags¶
For scenarios that aren't supported by default, fabric-cicd offers feature flags. Below is an exhaustive list of currently supported features, grouped by category.
Flags marked as Experimental (☑️) require the enable_experimental_features flag to be set in addition to the specific flag:
from fabric_cicd import append_feature_flag
append_feature_flag("enable_experimental_features")
append_feature_flag("<specific_flag>")
Publish behavior
| Flag Name | Description | Experimental |
|---|---|---|
enable_bulk_publish | Deploy all items in a single API call instead of one at a time (uses the bulk import beta API) | ☑️ |
enable_shortcut_publish | Deploy shortcuts with the Lakehouse | |
continue_on_shortcut_failure | Allow deployment to continue even when shortcuts fail to publish | |
disable_workspace_folder_publish | Disable deploying workspace sub folders | |
enable_environment_variable_replacement | Enable the use of pipeline variables for parameterization |
Unpublish behavior
| Flag Name | Description |
|---|---|
enable_lakehouse_unpublish | Enable the deletion of Lakehouses |
enable_warehouse_unpublish | Enable the deletion of Warehouses |
enable_sqldatabase_unpublish | Enable the deletion of SQL Databases |
enable_eventhouse_unpublish | Enable the deletion of Eventhouses |
enable_kqldatabase_unpublish | Enable the deletion of KQL Databases (attached to Eventhouses) |
enable_hard_delete | Enable hard deletion of items, bypassing the workspace recycle bin. Requires workspace Admin role. |
Selective deployment
| Flag Name | Description | Experimental |
|---|---|---|
enable_items_to_include | Enable selective publishing/unpublishing of specific items | ☑️ |
enable_exclude_folder | Enable folder-based exclusion during publish operations | ☑️ |
enable_include_folder | Enable folder-based inclusion during publish operations | ☑️ |
enable_shortcut_exclude | Enable selective publishing of shortcuts in a Lakehouse | ☑️ |
Diagnostics
| Flag Name | Description |
|---|---|
enable_response_collection | Enable collection of API responses during publish and unpublish operations |
Example
from fabric_cicd import append_feature_flag
append_feature_flag("enable_lakehouse_unpublish")
append_feature_flag("enable_warehouse_unpublish")
append_feature_flag("enable_environment_variable_replacement")
append_feature_flag("enable_response_collection")
Debugging¶
If an error arises, or you want full visibility into the API calls the library makes, enable debug logging:
Note: The "DEBUG" parameter can be omitted as it is the default value.
This writes all API calls to the terminal. To additionally capture logs and full stack traces to a fabric_cicd.error.log file, set the FABRIC_CICD_FILE_LOGGING_ENABLED environment variable:
For comprehensive debugging information, including how to use the error log file and debug scripts, see the Troubleshooting Guide.
Bulk Publish¶
Experimental
Bulk publish deploys all items in a single API call instead of publishing them one at a time. It uses the Fabric bulk import API, which is currently in beta. This feature applies to publishing only — unpublishing is not affected.
To enable bulk publish, set both enable_experimental_features and enable_bulk_publish feature flags:
from fabric_cicd import FabricWorkspace, publish_all_items, append_feature_flag
append_feature_flag("enable_experimental_features")
append_feature_flag("enable_bulk_publish")
workspace = FabricWorkspace(
workspace_id="your-workspace-id",
repository_directory="/path/to/repo",
item_type_in_scope=["Notebook", "DataPipeline", "Environment"],
token_credential=token_credential,
)
publish_all_items(workspace)
How it works¶
With bulk publishing, there is no predefined order of item types. The API leverages a dependency graph under the hood to determine the correct publishing sequence. As long as logical IDs are used to reference Fabric items, the API handles the rest — simplifying dependency management overhead. This may also reduce the complexity of your parameter file, though parameterization remains a key feature for edge cases and environment-specific customizations.
Since this feature is experimental, it is recommended for non-production environments only. We encourage you to use this period to provide feedback and help shape the bulk publish experience. The initial release does not support all fabric-cicd item types and lacks support for more advanced parameterization features, specifically dynamic replacement variables ($workspace, $items).
Items using item IDs instead of logical IDs
Item definitions in the same workspace that reference other items by item ID (rather than logical ID) can still be published via bulk publish. However, parameterization is required to ensure references are correctly re-pointed in the target workspace. The recommended approach is to use a find_replace parameter where the find_value is the referenced item's ID and the replace_value is its logical ID. For example, a Dataflow Gen2 item that references a Lakehouse by item ID — use find_replace to swap the Lakehouse's item ID with its logical ID so the bulk publish API can resolve the dependency.
Note that logical ID replacement may not be a valid solution for all item types. In such cases, you can either use standard publish where dynamic replacement variables are supported, or use a multi-phased bulk publish deployment by applying selective deployment to separate the affected items across phases.
For more details on logical IDs, see Resolve Logical ID Conflicts in Microsoft Fabric.
Authentication Requirements¶
When authenticating with a service principal or managed identity, all item types in a bulk call must support non-interactive authentication. If any item type in the batch does not, the entire call fails. Ensure your item_type_in_scope only includes item types with matching auth support.
Automatic Fallback to Standard Publish¶
Bulk publish will automatically fall back to standard publish mode when any of the following conditions are detected. A warning is logged when this occurs.
- Unsupported item types in scope:
DataBuildToolJobandWarehouseare not supported. If either is included initem_type_in_scope, the entire deployment uses standard publish. - No
item_type_in_scopespecified: Bulk publish requires an explicititem_type_in_scope. When omitted, all supported item types are included — which inevitably contains bulk unsupported types — so standard publish is used instead. - Dynamic parameter variables: Parameter files containing
$workspaceor$itemsreplacement variables require runtime resolution, which is incompatible with bulk publish.
Check your deployment logs for the message "Falling back to standard deployment..." to confirm whether bulk publish was actually used.
Other Limitations¶
- Item count limit: A maximum of 1,000 items can be published in a single bulk call. Exceeding this limit raises an error. Publish time may increase with higher item counts.
- Items without logical IDs: Items that do not have a logical ID assigned (indicated by an all-zeros GUID in the item's
.platformfile) are not supported by bulk publish. Connect your workspace via git integration to ensure logical IDs are properly assigned before using bulk publish. - Preview item types: Supported item types still in preview (e.g.,
Ontology) may produce errors for certain item definitions.
For common bulk publish errors and their solutions, see the Troubleshooting Guide.
Selective Deployment Features¶
By default, fabric-cicd performs a full deployment of all repository items. Selective deployment is an experimental feature due to the risk of deploying Fabric items that have dependencies on other items, which can result in broken deployments. These features support a range of filtering options, from broader folder-based selection to more granular item-level and shortcut-level filtering. To use these features, you must enable both the enable_experimental_features flag and the specific feature flag (if applicable). All selective deployment features are supported in both standard and bulk publish modes.
Warning: Selective deployment is not recommended due to potential issues with dependency management.
Folder-Level Filtering¶
A subset of items in the repository that exist within a Fabric workspace folder can be published using one of the following experimental features. Only one of these features can be applied during a deployment. Use case: selectively deploy a group of Fabric items (must be contained within folders). Folder-based item exclusion/inclusion is not supported in the unpublish scenario.
-
folder_path_exclude_regex- Optional parameter in
publish_all_items(), set to a regex pattern that matches Fabric folder path(s) containing items in the repository. - Requires the
enable_exclude_folderfeature flag. - The folder path(s) and items contained within that match the regex will be excluded from the publish operation.
- When using
folder_path_exclude_regex, the pattern is matched usingsearch()(substring match), so a pattern likesubfolder1will match any folder path containing "subfolder1" (e.g.,/subfolder1,/subfolder1/subfolder2,/other/subfolder1). - To target a specific folder, use an anchored pattern (e.g.,
^/subfolder1$) — this ensures only the exact folder path matches. - Child folders like
/subfolder1/subfolder2will also be excluded automatically since their parent folder was excluded, preserving a consistent folder hierarchy.
- Optional parameter in
-
folder_path_to_include- Optional parameter in
publish_all_items(), set to a list of strings that exactly match the folder path(s) containing items in the repository. - Requires the
enable_include_folderfeature flag. - Folder paths must start with
/(e.g.,/folder_nameor/folder_name/nested_folder). The matching folder path(s) and their contained items will be included in the publish operation; any other items contained within Fabric folders will be excluded. - When using
folder_path_to_includewith nested paths (e.g.,/subfolder1/subfolder2), ancestor folders (e.g.,/subfolder1) are automatically created to preserve the correct folder hierarchy, but items directly under the ancestor folder are not published unless the ancestor folder is also explicitly included in the list.
- Optional parameter in
Note: folder_path_exclude_regex and folder_path_to_include are mutually exclusive and cannot be used together for the same deployment. These filters are ignored when the disable_workspace_folder_publish feature flag is set. Root-level items (items not in any folder) are not impacted by either folder-level filter.
Item-Level Filtering¶
A subset of items in the repository can be published/unpublished using one of the following features. Both features are technically supported, but it is recommended to use one feature per deployment to avoid unexpected results.
-
item_name_exclude_regex- Optional parameter in
publish_all_items()andunpublish_all_orphan_items(), set to a regex pattern that matches item name(s) found in the repository. - This feature does not require any feature flags.
- Fabric items that match the regex will be excluded from the publish/unpublish operation.
- Optional parameter in
-
items_to_include- Optional parameter in
publish_all_items()andunpublish_all_orphan_items(), set to a list of strings that exactly match items in the repository. - Requires the
enable_items_to_includefeature flag. - Must be in the format:
"item_name.item_type". The matching item(s) will be included in the publish/unpublish operation.
- Optional parameter in
Note: item_name_exclude_regex and items_to_include can be applied to items within Fabric folders or standalone items. Item-level filtering can be combined with folder-level filtering, but be cautious when using both to avoid unexpected results.
Filter Precedence¶
Filters are evaluated in the following order:
items_to_include— Scope is narrowed upfront; only explicitly listed items proceed to further checksitem_name_exclude_regex— Items matching the regex are excludedfolder_path_exclude_regex— Items in matching folders are excludedfolder_path_to_include— Only items in specified folders are published
Note: folder_path_exclude_regex and folder_path_to_include are mutually exclusive — only one can be used per deployment. Root-level items (items not in any folder) are not impacted by either folder-level filter. When items_to_include is combined with exclusion filters, an item must first be in the include list before exclusion filters are evaluated against it.
Lakehouse Shortcut Filtering¶
Shortcuts are items associated with Lakehouse items and can be selectively published using the following experimental feature:
shortcut_exclude_regex- Optional parameter in
publish_all_items(), set to a regex pattern that matches the shortcut name(s) found within Lakehouse item(s) in the repository. - Requires the
enable_shortcut_excludefeature flag. - The matching shortcut(s) will be excluded from publishing.
- Optional parameter in
Note: This feature can be applied along with the other selective deployment features — please be cautious when using to avoid unexpected results.
Git-Based Change Detection¶
get_changed_items() is a public utility function that uses git diff to detect which Fabric items have been added, modified, or renamed relative to a given git reference. It returns a list of strings in "item_name.item_type" format that can be passed directly to items_to_include in publish_all_items().
While get_changed_items() itself requires no feature flags, passing its output to items_to_include requires the experimental feature flags.
Important: If get_changed_items() returns an empty list (no changes detected), do not call publish_all_items() without an explicit items_to_include list, as this would default to a full deployment. Always guard against the empty-list case:
from fabric_cicd import FabricWorkspace, publish_all_items, get_changed_items, append_feature_flag
append_feature_flag("enable_experimental_features")
append_feature_flag("enable_items_to_include")
workspace = FabricWorkspace(
workspace_id="your-workspace-id",
repository_directory="/path/to/repo",
item_type_in_scope=["Notebook", "DataPipeline"],
token_credential=token_credential, # or any other TokenCredential
)
changed = get_changed_items(workspace.repository_directory)
if changed:
publish_all_items(workspace, items_to_include=changed)
else:
print("No changed items detected — skipping deployment.")
To compare against a branch or a specific commit instead of the previous commit, pass a custom git_compare_ref:
Note: get_changed_items() returns only items that were modified or added (i.e., candidates for publishing). It does not return deleted items. Passing items_to_include to publish_all_items() requires enabling the enable_experimental_features and enable_items_to_include feature flags.