Code Reference¶
Provides tools for managing and publishing items in a Fabric workspace.
Classes:
| Name | Description |
|---|---|
DeploymentResult | Structured result of a config-based deployment operation. |
DeploymentStatus | Enumeration of deployment status values for deploy_with_config results. |
FabricWorkspace | A class to manage and publish workspace items to the Fabric API. |
FeatureFlag | Enumeration of supported feature flags for fabric-cicd. |
ItemType | Enumeration of supported Microsoft Fabric item types. |
Functions:
| Name | Description |
|---|---|
append_feature_flag | Append a feature flag to the global feature_flag set. |
change_log_level | Sets the log level for all loggers within the fabric_cicd package. Currently only supports DEBUG. |
configure_external_file_logging | Configure fabric_cicd package logging to integrate with an external logger's |
configure_fabric_fqdn | Configure Fabric API URLs for private-link-enabled workspaces. |
deploy_with_config | Deploy items using YAML configuration file with environment-specific settings. |
disable_file_logging | Disable file logging for the fabric_cicd package. |
get_changed_items | Return the list of Fabric items that were added, modified, or renamed relative to |
publish_all_items | Publishes all items defined in the |
unpublish_all_orphan_items | Unpublishes all orphaned items not present in the repository except for those matching the exclude regex. |
DeploymentResult dataclass ¶
DeploymentResult(
status: DeploymentStatus, message: str, responses: Optional[dict] = None
)
Structured result of a config-based deployment operation.
Returned by deploy_with_config on success. On failure, an instance is attached to the raised exception as e.deployment_result with status set to DeploymentStatus.FAILED.
Attributes:
| Name | Type | Description |
|---|---|---|
status | DeploymentStatus | The deployment status. |
message | str | A human-readable message describing the result. |
responses | Optional[dict] | Optional dictionary of API response data from the deployment. |
DeploymentStatus ¶
Bases: str, Enum
Enumeration of deployment status values for deploy_with_config results.
FabricWorkspace ¶
FabricWorkspace(
*,
repository_directory: str,
token_credential: TokenCredential,
item_type_in_scope: Optional[list[str]] = None,
environment: str = "N/A",
workspace_id: Optional[str] = None,
workspace_name: Optional[str] = None,
**kwargs: object,
)
A class to manage and publish workspace items to the Fabric API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repository_directory | str | Local directory path of the repository where items are to be deployed from. | required |
token_credential | TokenCredential | The token credential to use for API requests (e.g., AzureCliCredential, ClientSecretCredential) - required. | required |
item_type_in_scope | Optional[list[str]] | Item types that should be deployed for a given workspace. If omitted, defaults to all available item types. | None |
environment | str | The environment to be used for parameterization. | 'N/A' |
workspace_id | Optional[str] | The ID of the workspace to interact with. Either | None |
workspace_name | Optional[str] | The name of the workspace to interact with. Either | None |
kwargs | object | Additional keyword arguments. | {} |
Examples:
Basic usage
>>> from fabric_cicd import FabricWorkspace
>>> from azure.identity import AzureCliCredential
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/path/to/repo",
... item_type_in_scope=["Environment", "Notebook", "DataPipeline"],
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
Basic usage with workspace_name
>>> from fabric_cicd import FabricWorkspace
>>> from azure.identity import AzureCliCredential
>>> workspace = FabricWorkspace(
... workspace_name="your-workspace-name",
... repository_directory="/path/to/repo",
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
With optional parameters
>>> from fabric_cicd import FabricWorkspace
>>> from azure.identity import AzureCliCredential
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/your/path/to/repo",
... item_type_in_scope=["Environment", "Notebook", "DataPipeline"],
... environment="your-target-environment",
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
With service principal credentials
>>> from fabric_cicd import FabricWorkspace
>>> from azure.identity import ClientSecretCredential
>>> client_id = "your-client-id"
>>> client_secret = "your-client-secret"
>>> tenant_id = "your-tenant-id"
>>> token_credential = ClientSecretCredential(
... client_id=client_id, client_secret=client_secret, tenant_id=tenant_id
... )
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/your/path/to/repo",
... item_type_in_scope=["Environment", "Notebook", "DataPipeline"],
... token_credential=token_credential
... )
FeatureFlag ¶
Bases: str, Enum
Enumeration of supported feature flags for fabric-cicd.
CONTINUE_ON_SHORTCUT_FAILURE class-attribute instance-attribute ¶
Set to allow deployment to continue even when shortcuts fail to publish.
DISABLE_WORKSPACE_FOLDER_PUBLISH class-attribute instance-attribute ¶
Set to disable deploying workspace sub folders.
ENABLE_ENVIRONMENT_VARIABLE_REPLACEMENT class-attribute instance-attribute ¶
Set to enable the use of pipeline variables.
ENABLE_EVENTHOUSE_UNPUBLISH class-attribute instance-attribute ¶
Set to enable the deletion of Eventhouses.
ENABLE_EXCLUDE_FOLDER class-attribute instance-attribute ¶
Set to enable folder-based exclusion during publish operations.
ENABLE_EXPERIMENTAL_FEATURES class-attribute instance-attribute ¶
Set to enable experimental features, such as selective deployments.
ENABLE_HARD_DELETE class-attribute instance-attribute ¶
Set to enable hard deletion of items, bypassing the workspace recycle bin.
ENABLE_INCLUDE_FOLDER class-attribute instance-attribute ¶
Set to enable folder-based inclusion during publish operations.
ENABLE_ITEMS_TO_INCLUDE class-attribute instance-attribute ¶
Set to enable selective publishing/unpublishing of items.
ENABLE_KQLDATABASE_UNPUBLISH class-attribute instance-attribute ¶
Set to enable the deletion of KQL Databases (attached to Eventhouses).
ENABLE_LAKEHOUSE_UNPUBLISH class-attribute instance-attribute ¶
Set to enable the deletion of Lakehouses.
ENABLE_RESPONSE_COLLECTION class-attribute instance-attribute ¶
Set to enable collection of API responses during publish operations.
ENABLE_SHORTCUT_EXCLUDE class-attribute instance-attribute ¶
Set to enable selective publishing of shortcuts in a Lakehouse.
ENABLE_SHORTCUT_PUBLISH class-attribute instance-attribute ¶
Set to enable deploying shortcuts with the lakehouse.
ENABLE_SQLDATABASE_UNPUBLISH class-attribute instance-attribute ¶
Set to enable the deletion of SQL Databases.
ENABLE_WAREHOUSE_UNPUBLISH class-attribute instance-attribute ¶
Set to enable the deletion of Warehouses.
ItemType ¶
Bases: str, Enum
Enumeration of supported Microsoft Fabric item types.
append_feature_flag ¶
change_log_level ¶
Sets the log level for all loggers within the fabric_cicd package. Currently only supports DEBUG.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level | str | The logging level to set (e.g., DEBUG). | 'DEBUG' |
Warning
When debug is enabled, the log file generated by fabric-cicd (e.g., fabric_cicd.error.log) may contain sensitive information such as API endpoints, workspace identifiers, and request/response payloads. You are responsible for managing and deleting these files in accordance with your organization's security policies. Do not commit log files to source control or share them in unsecured channels.
Examples:
Basic usage
configure_external_file_logging ¶
Configure fabric_cicd package logging to integrate with an external logger's file handler. This is an advanced alternative to the default file logging configuration when level is set to DEBUG via change_log_level().
Extracts the file handler from the provided logger and configures fabric_cicd to append only DEBUG logs (e.g., API request/response details) to the same file. The external logger retains full ownership of the handler, including file rotation (if applicable) and lifecycle management.
Note
-
This function resets logging configuration. Use as an alternative to
change_log_level()ordisable_file_logging(), not in combination -
Only DEBUG logs from the fabric_cicd package are written to the log file. Exception messages are displayed on the console, but full stack traces are not written to the external log file
-
Console output remains at INFO level (default fabric_cicd console behavior)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
external_logger | Logger | The external logger instance that has a | required |
Raises:
| Type | Description |
|---|---|
ValueError | If no file handler is found on the provided logger. |
Examples:
General usage:
>>> import logging
>>> from logging.handlers import RotatingFileHandler
>>> from fabric_cicd import configure_external_file_logging
...
>>> # Set up your own logger with a file handler
>>> my_logger = logging.getLogger("MyApp")
>>> handler = RotatingFileHandler("app.log", maxBytes=5*1024*1024, backupCount=7)
>>> handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(message)s"))
>>> my_logger.addHandler(handler)
...
>>> # Configure fabric_cicd to use the same file
>>> configure_external_file_logging(my_logger)
configure_fabric_fqdn ¶
Configure Fabric API URLs for private-link-enabled workspaces.
Updates the global Fabric API URL constants to use the FQDN format required for private-link-enabled workspaces. Call this function before initializing a FabricWorkspace if you are using a private-link-enabled workspace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workspace_id | str | The workspace ID string in standard GUID format with dashes (e.g., "f953f3da-c5f0-4e36-a644-c85933e35e2f"). | required |
Side Effects
Updates the module-level constants in fabric_cicd.constants: - FABRIC_API_ROOT_URL: Set to the FQDN URL derived from workspace_id - DEFAULT_API_ROOT_URL: Set to the same FQDN URL
Examples:
Basic usage with FabricWorkspace:
>>> from fabric_cicd import configure_fabric_fqdn, FabricWorkspace
>>> from azure.identity import AzureCliCredential
>>>
>>> workspace_id = "f953f3da-c5f0-4e36-a644-c85933e35e2f"
>>> configure_fabric_fqdn(workspace_id)
>>>
>>> token_credential = AzureCliCredential()
>>> workspace = FabricWorkspace(
... workspace_id=workspace_id,
... repository_directory="/path/to/workspace",
... token_credential=token_credential
... )
deploy_with_config ¶
deploy_with_config(
config_file_path: str,
*,
token_credential: TokenCredential,
environment: str = "N/A",
config_override: Optional[dict] = None,
) -> DeploymentResult
Deploy items using YAML configuration file with environment-specific settings. This function provides a simplified deployment interface that loads configuration from a YAML file and executes deployment operations based on environment-specific settings. It constructs the necessary FabricWorkspace object internally and handles publish/unpublish operations according to the configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_file_path | str | Path to the YAML configuration file as a string. | required |
token_credential | TokenCredential | Azure token credential for authentication (e.g., AzureCliCredential, ClientSecretCredential) - required. | required |
environment | str | Environment name to use for deployment (e.g., 'dev', 'test', 'prod'), if missing defaults to 'N/A'. | 'N/A' |
config_override | Optional[dict] | Optional dictionary to override specific configuration values. | None |
Returns:
| Name | Type | Description |
|---|---|---|
DeploymentResult | DeploymentResult | A result object containing the deployment status, message, and responses (opt-in). The status will be DeploymentStatus.COMPLETED on success. The responses field contains a dictionary with |
Raises:
| Type | Description |
|---|---|
InputError | If configuration is invalid, environment not found, or input validation fails. |
ConfigValidationError | If configuration file is missing or fails structural validation. |
Note
On failure, the raised exception will have a deployment_result attribute containing a DeploymentResult with status set to DeploymentStatus.FAILED, message set to the error description, and responses containing any partial API responses collected before the failure (requires the enable_response_collection feature flag, otherwise None).
Examples:
Basic usage
>>> from fabric_cicd import deploy_with_config
>>> from azure.identity import AzureCliCredential
>>> credential = AzureCliCredential()
>>> result = deploy_with_config(
... config_file_path="workspace/config.yml",
... token_credential=credential,
... environment="prod"
... )
>>> print(result.status) # DeploymentStatus.COMPLETED
>>> print(result.message) # "Deployment completed successfully"
>>> print(result.responses) # {"publish": {...}, "unpublish": {...}} or None
With custom authentication
>>> from fabric_cicd import deploy_with_config
>>> from azure.identity import ClientSecretCredential
>>> credential = ClientSecretCredential(tenant_id, client_id, client_secret)
>>> result = deploy_with_config(
... config_file_path="workspace/config.yml",
... token_credential=credential,
... environment="prod"
... )
With override configuration
>>> from fabric_cicd import deploy_with_config
>>> from azure.identity import ClientSecretCredential
>>> credential = ClientSecretCredential(tenant_id, client_id, client_secret)
>>> result = deploy_with_config(
... config_file_path="workspace/config.yml",
... token_credential=credential,
... environment="prod",
... config_override={
... "core": {
... "item_types_in_scope": ["Notebook"]
... },
... "publish": {
... "skip": {
... "prod": False
... }
... }
... }
... )
Handling deployment failures
>>> from fabric_cicd import deploy_with_config
>>> from azure.identity import AzureCliCredential
>>> credential = AzureCliCredential()
>>> try:
... result = deploy_with_config(
... config_file_path="workspace/config.yml",
... token_credential=credential,
... environment="prod"
... )
... print(result.status) # DeploymentStatus.COMPLETED
... print(result.message) # "Deployment completed successfully"
... print(result.responses) # {"publish": {...}, "unpublish": {...}} or None
... except Exception as e:
... print(e.deployment_result.status) # DeploymentStatus.FAILED
... print(e.deployment_result.message) # Original error message
... print(e.deployment_result.responses) # Partial API responses or None
disable_file_logging ¶
Disable file logging for the fabric_cicd package.
When called, no log file will be created and only console logging will occur at the default INFO level.
Note
- This function is intended to be used as an alternative to
change_log_level()orconfigure_external_file_logging(), not in combination with them as this will reset logging configurations to INFO-level console output only. - Exception messages will still be displayed on the console, but full stack traces will not be written to any log file or console.
Examples:
Basic usage
get_changed_items ¶
Return the list of Fabric items that were added, modified, or renamed relative to git_compare_ref.
The returned list is in "item_name.item_type" format and can be passed directly to the items_to_include parameter of :func:publish_all_items to deploy only what has changed since the last commit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repository_directory | Path | Path to the local git repository directory (e.g. | required |
git_compare_ref | str | Git ref to compare against. Defaults to | 'HEAD~1' |
Returns:
| Type | Description |
|---|---|
list[str] | List of strings in |
list[str] | no changes are detected, the git root cannot be found, or git is unavailable. |
Examples:
Deploy only changed items
>>> from azure.identity import AzureCliCredential
>>> from fabric_cicd import FabricWorkspace, publish_all_items, get_changed_items
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/path/to/repo",
... item_type_in_scope=["Notebook", "DataPipeline"],
... token_credential=AzureCliCredential()
... )
>>> changed = get_changed_items(workspace.repository_directory)
>>> if changed:
... publish_all_items(workspace, items_to_include=changed)
With a custom git ref
publish_all_items ¶
publish_all_items(
fabric_workspace_obj: FabricWorkspace,
item_name_exclude_regex: Optional[str] = None,
folder_path_exclude_regex: Optional[str] = None,
folder_path_to_include: Optional[list[str]] = None,
items_to_include: Optional[list[str]] = None,
shortcut_exclude_regex: Optional[str] = None,
) -> Optional[dict]
Publishes all items defined in the item_type_in_scope list of the given FabricWorkspace object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fabric_workspace_obj | FabricWorkspace | The FabricWorkspace object containing the items to be published. | required |
item_name_exclude_regex | Optional[str] | Regex pattern to exclude specific items from being published. | None |
folder_path_exclude_regex | Optional[str] | Regex pattern matched against folder paths (e.g., "/folder_name") to exclude folders and their items from being published. | None |
folder_path_to_include | Optional[list[str]] | List of folder paths in the format "/folder_name"; only the specified folders and their items will be published. | None |
items_to_include | Optional[list[str]] | List of items in the format "item_name.item_type" that should be published. | None |
shortcut_exclude_regex | Optional[str] | Regex pattern to exclude specific shortcuts from being published in lakehouses. | None |
Returns:
| Type | Description |
|---|---|
Optional[dict] | Dict containing all API responses if the |
Optional[dict] | and at least one response was collected; otherwise, None. |
folder_path_exclude_regex
This is an experimental feature in fabric-cicd. Use at your own risk as selective deployments are not recommended due to item dependencies. Cannot be used together with folder_path_to_include for the same environment. To enable this feature, see How To -> Optional Features for information on which flags to enable.
folder_path_to_include
This is an experimental feature in fabric-cicd. Use at your own risk as selective deployments are not recommended due to item dependencies. Cannot be used together with folder_path_exclude_regex for the same environment. To enable this feature, see How To -> Optional Features for information on which flags to enable.
items_to_include
This is an experimental feature in fabric-cicd. Use at your own risk as selective deployments are not recommended due to item dependencies. To enable this feature, see How To -> Optional Features for information on which flags to enable.
shortcut_exclude_regex
This is an experimental feature in fabric-cicd. Use at your own risk as selective shortcut deployments may result in missing data dependencies. To enable this feature, see How To -> Optional Features for information on which flags to enable.
Examples:
Basic usage
>>> from fabric_cicd import FabricWorkspace, publish_all_items
>>> from azure.identity import AzureCliCredential
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/path/to/repo",
... item_type_in_scope=["Environment", "Notebook", "DataPipeline"],
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
>>> publish_all_items(workspace)
With regex name exclusion
>>> from fabric_cicd import FabricWorkspace, publish_all_items
>>> from azure.identity import AzureCliCredential
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/path/to/repo",
... item_type_in_scope=["Environment", "Notebook", "DataPipeline"],
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
>>> exclude_regex = ".*_do_not_publish"
>>> publish_all_items(workspace, item_name_exclude_regex=exclude_regex)
With folder exclusion
>>> from fabric_cicd import FabricWorkspace, publish_all_items, append_feature_flag
>>> from azure.identity import AzureCliCredential
>>> append_feature_flag("enable_experimental_features")
>>> append_feature_flag("enable_exclude_folder")
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/path/to/repo",
... item_type_in_scope=["Environment", "Notebook", "DataPipeline"],
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
>>> folder_exclude_regex = "^/legacy"
>>> publish_all_items(workspace, folder_path_exclude_regex=folder_exclude_regex)
With folder inclusion
>>> from fabric_cicd import FabricWorkspace, publish_all_items, append_feature_flag
>>> from azure.identity import AzureCliCredential
>>> append_feature_flag("enable_experimental_features")
>>> append_feature_flag("enable_include_folder")
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/path/to/repo",
... item_type_in_scope=["Environment", "Notebook", "DataPipeline"],
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
>>> folder_path_to_include = ["/subfolder"]
>>> publish_all_items(workspace, folder_path_to_include=folder_path_to_include)
With items to include
>>> from fabric_cicd import FabricWorkspace, publish_all_items, append_feature_flag
>>> from azure.identity import AzureCliCredential
>>> 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=["Environment", "Notebook", "DataPipeline"],
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
>>> items_to_include = ["Hello World.Notebook", "Hello.Environment"]
>>> publish_all_items(workspace, items_to_include=items_to_include)
With shortcut exclusion
>>> from fabric_cicd import FabricWorkspace, publish_all_items, append_feature_flag
>>> from azure.identity import AzureCliCredential
>>> append_feature_flag("enable_experimental_features")
>>> append_feature_flag("enable_shortcut_exclude")
>>> append_feature_flag("enable_shortcut_publish")
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/path/to/repo",
... item_type_in_scope=["Lakehouse"],
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
>>> shortcut_exclude_regex = "^temp_.*" # Exclude shortcuts starting with "temp_"
>>> publish_all_items(workspace, shortcut_exclude_regex=shortcut_exclude_regex)
With response collection
>>> from fabric_cicd import FabricWorkspace, publish_all_items, append_feature_flag
>>> from azure.identity import AzureCliCredential
>>> append_feature_flag("enable_response_collection")
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/path/to/repo",
... item_type_in_scope=["Environment", "Notebook", "DataPipeline"],
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
>>> responses = publish_all_items(workspace)
>>> # Access all responses
>>> print(responses)
>>> # Access individual item response (dict with "header", "body", "status_code" keys)
>>> notebook_response = workspace.responses["Notebook"]["Hello World"]
>>> print(notebook_response["status_code"]) # e.g., 200
With get_changed_items (deploy only git-changed items)
>>> from fabric_cicd import FabricWorkspace, publish_all_items, get_changed_items
>>> from azure.identity import AzureCliCredential
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/path/to/repo",
... item_type_in_scope=["Notebook", "DataPipeline"],
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
>>> changed = get_changed_items(workspace.repository_directory)
>>> if changed:
... publish_all_items(workspace, items_to_include=changed)
unpublish_all_orphan_items ¶
unpublish_all_orphan_items(
fabric_workspace_obj: FabricWorkspace,
item_name_exclude_regex: str = "^$",
items_to_include: Optional[list[str]] = None,
) -> Optional[dict]
Unpublishes all orphaned items not present in the repository except for those matching the exclude regex.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fabric_workspace_obj | FabricWorkspace | The FabricWorkspace object containing the items to be unpublished. | required |
item_name_exclude_regex | str | Regex pattern to exclude specific items from being unpublished. Default is '^$' which will exclude nothing. | '^$' |
items_to_include | Optional[list[str]] | List of items in the format "item_name.item_type" that should be unpublished. | None |
Returns:
| Type | Description |
|---|---|
Optional[dict] | Dict containing all collected API responses if the |
Optional[dict] | and at least one response was collected; otherwise, None. |
Note
By default, the Fabric Delete Item API moves deleted items to the workspace recycle bin. However, not all item types support soft delete; for those types, deletion requires the enable_hard_delete feature flag. Enabling this flag bypasses the recycle bin and permanently deletes items. Hard delete requires the workspace Admin role.
items_to_include
This is an experimental feature in fabric-cicd. Use at your own risk as selective unpublishing is not recommended due to item dependencies. To enable this feature, see How To -> Optional Features for information on which flags to enable.
Examples:
Basic usage
>>> from fabric_cicd import FabricWorkspace, publish_all_items, unpublish_all_orphan_items
>>> from azure.identity import AzureCliCredential
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/path/to/repo",
... item_type_in_scope=["Environment", "Notebook", "DataPipeline"],
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
>>> publish_all_items(workspace)
>>> unpublish_all_orphan_items(workspace)
With regex name exclusion
>>> from fabric_cicd import FabricWorkspace, publish_all_items, unpublish_all_orphan_items
>>> from azure.identity import AzureCliCredential
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/path/to/repo",
... item_type_in_scope=["Environment", "Notebook", "DataPipeline"],
... token_credential=AzureCliCredential()
... )
>>> publish_all_items(workspace)
>>> exclude_regex = ".*_do_not_delete"
>>> unpublish_all_orphan_items(workspace, item_name_exclude_regex=exclude_regex)
With items to include
>>> from fabric_cicd import FabricWorkspace, publish_all_items, unpublish_all_orphan_items, append_feature_flag
>>> from azure.identity import AzureCliCredential
>>> 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=["Environment", "Notebook", "DataPipeline"],
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
>>> publish_all_items(workspace)
>>> items_to_include = ["Hello World.Notebook", "Run Hello World.DataPipeline"]
>>> unpublish_all_orphan_items(workspace, items_to_include=items_to_include)
With response collection
>>> from fabric_cicd import FabricWorkspace, publish_all_items, unpublish_all_orphan_items, append_feature_flag
>>> from azure.identity import AzureCliCredential
>>> append_feature_flag("enable_response_collection")
>>> workspace = FabricWorkspace(
... workspace_id="your-workspace-id",
... repository_directory="/path/to/repo",
... item_type_in_scope=["Environment", "Notebook", "DataPipeline"],
... token_credential=AzureCliCredential() # or any other TokenCredential
... )
>>> publish_all_items(workspace)
>>> responses = unpublish_all_orphan_items(workspace)
>>> # Access all unpublish responses
>>> print(responses)
>>> # Access individual item response (dict with "header", "body", "status_code" keys)
>>> notebook_response = workspace.unpublish_responses["Notebook"]["Hello World"]
>>> print(notebook_response["status_code"]) # e.g., 200