Skip to content

Keep online endpoint/deployment operations pinned to workspace scope for registry-backed clients - #48325

Open
Chakradhar886 with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-ml-registry-deployment-issue
Open

Keep online endpoint/deployment operations pinned to workspace scope for registry-backed clients#48325
Chakradhar886 with Copilot wants to merge 4 commits into
mainfrom
copilot/fix-ml-registry-deployment-issue

Conversation

Copilot AI commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Online deployment requests could be sent to the registry resource group when a client was initialized to consume registry assets and target a workspace in a different resource group. In that configuration, endpoint/deployment operations looked up the workspace endpoint under the wrong RG and failed with ResourceNotFound.

  • Scope isolation for online operations

    • Introduce a dedicated workspace-scoped OperationScope for online endpoint and online deployment operations.
    • Keep registry-backed asset operations on registry scope, but force online control-plane calls to use the workspace subscription/resource group/workspace.
  • Dedicated service clients for online calls

    • Create workspace-scoped 2022-02 and 2023-04-preview ARM clients specifically for online endpoint/deployment operations.
    • Route OnlineEndpointOperations and OnlineDeploymentOperations through those workspace-scoped clients instead of the registry-shifted shared scope.
  • Regression coverage

    • Add a unit test that initializes MLClient with a registry plus workspace_reference and asserts:
      • online endpoint/deployment operations retain workspace scope
      • model/data operations continue to use registry scope
  • Behavioral effect

    • Registry assets can still be referenced from a different resource group, while online endpoint/deployment resolution stays anchored to the target workspace.
ml_client = MLClient(
    credential=credential,
    subscription_id=workspace_sub,
    resource_group_name=workspace_rg,
    registry_name="my-registry",
    workspace_reference="my-workspace",
)

# Registry-backed assets may resolve via registry scope,
# but online endpoint/deployment operations stay on workspace scope.
ml_client.online_deployments.begin_create_or_update(deployment)

…d clients

Co-authored-by: Chakradhar886 <259224138+Chakradhar886@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

…0 chars)

Co-authored-by: Chakradhar886 <259224138+Chakradhar886@users.noreply.github.com>
@Chakradhar886
Chakradhar886 marked this pull request as ready for review July 29, 2026 11:07
Copilot AI review requested due to automatic review settings July 29, 2026 11:08
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Pins online endpoint and deployment operations to workspace scope while preserving registry scope for assets.

Changes:

  • Adds workspace-scoped online operation clients and scopes.
  • Adds regression coverage for mixed workspace/registry configuration.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
azure/ai/ml/_ml_client.py Routes online operations through workspace-scoped clients.
tests/internal_utils/unittests/test_ml_client.py Tests workspace and registry scope isolation.

Comment on lines +549 to +563
online_endpoint_scope = captured["OnlineEndpointOperations"]["scope"]
online_deployment_scope = captured["OnlineDeploymentOperations"]["scope"]
model_scope = captured["ModelOperations"]["scope"]
data_scope = captured["DataOperations"]["scope"]

assert online_endpoint_scope.subscription_id == workspace_sub
assert online_endpoint_scope.resource_group_name == workspace_rg
assert online_endpoint_scope.workspace_name == workspace_name
assert online_deployment_scope.subscription_id == workspace_sub
assert online_deployment_scope.resource_group_name == workspace_rg
assert online_deployment_scope.workspace_name == workspace_name
assert model_scope.subscription_id == registry_sub
assert model_scope.resource_group_name == registry_rg
assert data_scope.subscription_id == registry_sub
assert data_scope.resource_group_name == registry_rg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants