Problem creating pipeline job using ml_client.jobs.create_or_update, gives http response error

Muhammad Hamza Shafiq 0 Reputation points
2024-01-07T20:31:05.02+00:00

I am trying to create a pipeline job using ml_client.jobs.create_or_update, which gives following error:

HttpResponseError: (UserError) Subscription, ResourceGroup, or WorkspaceName of the input uri does not match the current workspace
Code: UserError
Message: Subscription, ResourceGroup, or WorkspaceName of the input uri does not match the current workspace

I double checked the code and also used interactive authentication but still it does not work :

from azureml.core.authentication import InteractiveLoginAuthentication
ia = InteractiveLoginAuthentication(tenant_id='QQQQQQ-AAAA-SSSS-DDDD-XXXXXXXXX')
ml_client = MLClient(credential=credential,
                     subscription_id=subscription_id,
                     resource_group_name=resource_group,
                     workspace_name=workspace_name,
                     auth=ia)
if run_pipeline:
    pipeline_job = ml_client.jobs.create_or_update(
        pipeline,
        experiment_name=experiment_name,
    )
Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,887 questions
{count} votes

2 answers

Sort by: Most helpful
  1. dupammi 8,465 Reputation points Microsoft Vendor
    2024-01-08T07:11:21.26+00:00

    Hi @Muhammad Hamza Shafiq ,

    Thank you for using the Microsoft Q&A forum.

    For debugging purpose, I would suggest you try using the Workspace.from_config() method to retrieve the workspace details from the config file.

    Following are the steps to download the config.json file.

    • Log in to the Azure portal.
    • Navigate to the Azure Machine Learning workspace that you were trying to use.
    • Click on the "Download config.json" button.

    User's image

    • Save the config.json file to your current directory.
    • use the Workspace.from_config() method to retrieve the workspace details from the config file. Here's an example of how to do this
    from azure.ml.core import Workspace
    from azure.ml import MLClient
    
    # Get current workspace from config file
    workspace = Workspace.from_config()
    
    # Create ML client with current workspace
    client = MLClient(workspace=workspace)
    

    For more details, please refer- different authentication-methods-in-azureml

    I hope this helps. Thanks!

    0 comments No comments

  2. Matthew Nilsen 0 Reputation points Microsoft Employee
    2024-10-01T20:50:44.56+00:00

    I ran into this same error. Note that it says **"of the input uri."**Make sure that if you have something like this, that you are using the same resource group and workspace that your ml client is connected to:

    Input(type="uri_file", path="azureml://.../resourcegroups/<rg>/workspaces/<rg>/datastores/workspaceblobstore/paths/UI/2024-09-27_233602_UTC/<file>.csv")
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.