{"id":8144,"library":"fabric-cicd","title":"Microsoft Fabric CI/CD","description":"The `fabric-cicd` library provides a Pythonic interface and command-line tool for implementing Continuous Integration/Continuous Deployment (CI/CD) pipelines for Microsoft Fabric artifacts. It enables programmatic deployment, lifecycle management, and automation of Fabric items like notebooks, lakehouses, and data pipelines. Currently at version 0.3.1, it is under active development with frequent releases targeting new Fabric capabilities and improvements.","status":"active","version":"0.3.1","language":"en","source_language":"en","source_url":"https://github.com/microsoft/fabric-cicd.git","tags":["microsoft fabric","cicd","deployment","data platform","azure","automation"],"install":[{"cmd":"pip install fabric-cicd","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for Azure Active Directory authentication (Service Principal).","package":"msal","optional":false},{"reason":"Used for data validation and settings management.","package":"pydantic","optional":false},{"reason":"HTTP client for interacting with Fabric APIs.","package":"requests","optional":false},{"reason":"Used for loading configuration files, common in CI/CD scenarios.","package":"pyyaml","optional":false}],"imports":[{"note":"The primary client class is nested within the 'fabric_cicd_client' module, not directly under the top-level package.","wrong":"from fabric_cicd import FabricCICDClient","symbol":"FabricCICDClient","correct":"from fabric_cicd.fabric_cicd_client import FabricCICDClient"}],"quickstart":{"code":"import os\nfrom fabric_cicd.fabric_cicd_client import FabricCICDClient\n\n# Ensure these environment variables are set for your service principal\nTENANT_ID = os.environ.get('FABRIC_TENANT_ID', 'YOUR_TENANT_ID')\nCLIENT_ID = os.environ.get('FABRIC_CLIENT_ID', 'YOUR_CLIENT_ID')\nCLIENT_SECRET = os.environ.get('FABRIC_CLIENT_SECRET', 'YOUR_CLIENT_SECRET')\n\nif not all([TENANT_ID, CLIENT_ID, CLIENT_SECRET]):\n    print(\"Error: FABRIC_TENANT_ID, FABRIC_CLIENT_ID, and FABRIC_CLIENT_SECRET environment variables must be set.\")\n    print(\"Please configure these environment variables with your Azure Service Principal credentials.\")\n    exit(1)\n\ntry:\n    # Initialize the client\n    client = FabricCICDClient(\n        tenant_id=TENANT_ID,\n        client_id=CLIENT_ID,\n        client_secret=CLIENT_SECRET\n    )\n\n    # Example: List workspaces (requires appropriate permissions)\n    print(\"\\nFetching Fabric workspaces...\")\n    workspaces = client.get_workspaces()\n    if workspaces:\n        print(f\"Found {len(workspaces)} workspaces:\")\n        for ws in workspaces[:3]: # Print first 3 for brevity\n            print(f\"  - {ws.display_name} (ID: {ws.id})\")\n    else:\n        print(\"No workspaces found or insufficient permissions.\")\n\n    # Example: Deploy a dummy item (requires actual item ID and target workspace ID)\n    # Uncomment and replace placeholders with actual values for deployment functionality.\n    # source_workspace_id = \"<YOUR_SOURCE_WORKSPACE_ID>\"\n    # item_id = \"<YOUR_ITEM_ID>\" # e.g., Notebook ID, Lakehouse ID\n    # target_workspace_id = \"<YOUR_TARGET_WORKSPACE_ID>\"\n    #\n    # print(f\"\\nAttempting to deploy item {item_id} from {source_workspace_id} to {target_workspace_id}...\")\n    # try:\n    #     result = client.deploy_item(source_workspace_id, item_id, target_workspace_id)\n    #     print(f\"Deployment successful: {result}\")\n    # except Exception as e:\n    #     print(f\"Deployment failed: {e}\")\n\nexcept Exception as e:\n    print(f\"\\nAn error occurred during client operation: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize the `FabricCICDClient` using Azure Service Principal credentials and perform a basic operation like listing Fabric workspaces. It uses environment variables for secure credential management. Authentication via a Service Principal is the recommended approach for automated CI/CD pipelines in Microsoft Fabric."},"warnings":[{"fix":"Verify Service Principal setup in Azure AD (Client ID, Tenant ID, Client Secret) and assign appropriate Fabric roles/permissions via the Fabric UI or PowerShell. Check logs for specific error messages (e.g., AADSTS codes).","message":"Authentication heavily relies on Azure Service Principals. Ensure your Service Principal has the necessary permissions (e.g., Fabric Contributor or specific delegated permissions) on the target workspaces/items in Microsoft Fabric and is correctly registered in Azure AD. Incorrect permissions are a common source of 'Forbidden' or 'Unauthorized' errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Familiarize yourself with Fabric workspace and item IDs. Use `client.get_workspaces()` and `client.get_workspace_items(workspace_id)` to programmatically retrieve these details and ensure they match your deployment intent.","message":"The library differentiates between source and target workspaces during deployment. Understand the lifecycle of your Fabric items and how they are identified (e.g., by ID, type, name). Misunderstanding item identifiers or workspace relationships can lead to deployment failures.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Pin your `fabric-cicd` version in `requirements.txt` (e.g., `fabric-cicd==0.3.1`) and thoroughly test when upgrading to new minor or major versions. Always review release notes for breaking changes and migration guidance.","message":"As of version 0.3.x, the library is still under active development, and its API is subject to change. Future versions (especially leading up to 1.0) may introduce breaking changes to method signatures, class structures, or authentication flows.","severity":"breaking","affected_versions":"<1.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install fabric-cicd` to install the library.","cause":"The `fabric-cicd` package is not installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'fabric_cicd'"},{"fix":"Double-check the `FABRIC_CLIENT_ID` and `FABRIC_TENANT_ID` values. Verify the Service Principal exists and is correctly configured in your Azure Active Directory.","cause":"Authentication failed. This typically means the Client ID (Application ID) is incorrect, the Tenant ID is wrong, or the Service Principal has not been registered in the specified Azure AD tenant.","error":"msal.exceptions.MsalServiceException: AADSTS700016: Application with identifier '...' was not found in the directory '...' or 'AADSTS500011: The resource principal named '...' was not found in the tenant named '...'"},{"fix":"Generate a new client secret in Azure AD for your Service Principal and update the `FABRIC_CLIENT_SECRET` environment variable or configuration.","cause":"The client secret provided for the Service Principal is incorrect or has expired.","error":"msal.exceptions.MsalServiceException: AADSTS7000215: Invalid client secret is provided."},{"fix":"Grant the Service Principal appropriate permissions in the Microsoft Fabric workspace settings (e.g., 'Contributor' role) or through specific item-level permissions. Confirm the Service Principal is added to the workspace access list.","cause":"The authenticated Service Principal lacks the necessary permissions (e.g., Read, Write, Deploy) on the target Microsoft Fabric workspace or item to perform the requested operation.","error":"requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: ..."}]}