Skip to content

Closes #909 Remove defaultazurecredential fallback path#910

Merged
shirasassoon merged 5 commits intomicrosoft:mainfrom
shirasassoon:deprecate_defaultazurecredential_path
Mar 31, 2026
Merged

Closes #909 Remove defaultazurecredential fallback path#910
shirasassoon merged 5 commits intomicrosoft:mainfrom
shirasassoon:deprecate_defaultazurecredential_path

Conversation

@shirasassoon
Copy link
Copy Markdown
Contributor

This pull request introduces a breaking change to the authentication mechanism in FabricWorkspace: the default credential fallback has been removed, and an explicit token_credential must now be provided for API requests. The codebase and tests have been updated accordingly to enforce this requirement and provide clearer error messaging.

Breaking change to authentication:

  • Removed the use of DefaultAzureCredential as a fallback; FabricWorkspace now requires an explicit token_credential to be passed for authentication. Attempting to instantiate without a credential (outside Fabric runtime) raises an InputError with a clear message. [1] [2]

Documentation and interface improvements:

  • Updated docstrings in fabric_workspace.py to clarify the requirement for an explicit token_credential and provide usage examples.

Test suite updates:

Type annotation improvement:

  • Updated the token_credential parameter type in FabricWorkspace.__init__ to be explicitly Optional[TokenCredential] for better type clarity.

@shirasassoon shirasassoon marked this pull request as ready for review March 29, 2026 12:16
Copilot AI review requested due to automatic review settings March 29, 2026 12:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the DefaultAzureCredential fallback in FabricWorkspace so API authentication requires an explicit token_credential (except when running in Fabric runtime), and updates tests/changelog to match this breaking change.

Changes:

  • Enforce explicit token_credential in FabricWorkspace.__init__ (no DefaultAzureCredential fallback outside Fabric runtime).
  • Update unit tests to pass DummyTokenCredential when constructing FabricWorkspace.
  • Add an unreleased breaking-change entry describing the auth change.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/fabric_cicd/fabric_workspace.py Removes default credential fallback, raises InputError when credential is missing outside Fabric runtime, and adjusts typing/docstring.
tests/test_publish.py Passes DummyTokenCredential into FabricWorkspace instances used by publish/unpublish tests.
tests/test_fabric_workspace.py Updates workspace factory and specific tests to pass DummyTokenCredential.
tests/test_response_collection.py Supplies DummyTokenCredential for workspace creation in response-collection tests.
tests/test_subfolders.py Supplies DummyTokenCredential for workspace creation in subfolder tests.
.changes/unreleased/breaking-20260329-150739.yaml Adds changelog entry documenting the breaking authentication change.
Comments suppressed due to low confidence (1)

src/fabric_cicd/fabric_workspace.py:56

  • The docstring now implies/illustrates that FabricWorkspace can be created without a token_credential (see the “Basic usage” examples below), but __init__ will raise an InputError outside Fabric runtime when token_credential is omitted. Update the examples and/or argument description to reflect that token_credential is required outside Fabric runtime (and only auto-generated when running in Fabric).
        Args:
            workspace_id: The ID of the workspace to interact with. Either `workspace_id` or `workspace_name` must be provided. Considers only `workspace_id` if both are specified.
            workspace_name: The name of the workspace to interact with. Either `workspace_id` or `workspace_name` must be provided. Considers only `workspace_id` if both are specified.
            repository_directory: Local directory path of the repository where items are to be deployed from.
            item_type_in_scope: Item types that should be deployed for a given workspace. If omitted, defaults to all available item types.
            environment: The environment to be used for parameterization.
            token_credential: The token credential to use for API requests (e.g., AzureCliCredential, ClientSecretCredential).
            kwargs: Additional keyword arguments.

        Examples:
            Basic usage
            >>> from fabric_cicd import FabricWorkspace
            >>> workspace = FabricWorkspace(

@shirasassoon shirasassoon merged commit afa9441 into microsoft:main Mar 31, 2026
13 checks passed
@shirasassoon shirasassoon deleted the deprecate_defaultazurecredential_path branch March 31, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants