Skip to content

azureml-mlflow: Unable to log models to Azure using MLFlow using latest package versions #44896

@Anjum48

Description

@Anjum48
  • Package Name: azureml-mlflow
  • Package Version: 1.61.0.post1
  • Operating System: Windows 11
  • Python Version: 3.13.7

Describe the bug
When logging a model using mlflow.pytorch.log_model I get this exception:

mlflow.exceptions.MlflowException: API request to endpoint /api/2.0/mlflow/logged-models failed with error code 404 != 200. Response body: ''

In appears that the Azure MLFlow server does not have this endpoint implemented?

This is repeatable on:

  • azureml-mlflow==1.60.0
  • mlflow==3.5.0 and mlflow==3.8.1
  • mlflow-skinny==3.5.0 and mlflow-skinny==3.8.1

Note that MLFlow >= 3.5.0 is required due to security vulnerabilities

To Reproduce

from torch import nn
import mlflow
from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential


model = nn.Sequential(nn.Linear(28 * 28, 64), nn.ReLU(), nn.Linear(64, 3))

ml_client = MLClient.from_config(credential=DefaultAzureCredential())
mlflow_tracking_uri = getattr(
    ml_client.workspaces.get(ml_client.workspace_name), "mlflow_tracking_uri", None
)

if mlflow_tracking_uri is None:
    raise ValueError("MLflow tracking URI is not set in the Azure ML workspace.")

mlflow.set_tracking_uri(mlflow_tracking_uri)

mlflow.set_experiment("azure-experiment-name")
mlflow.pytorch.autolog(log_models=False)

with mlflow.start_run(run_name="MLFlow Test") as run:
    mlflow.pytorch.log_model(
        model,
        "pl_model",
        pip_requirements="requirements.txt",
    )

Traceback:

Found the config file in: .\config.json
Class DeploymentTemplateOperations: This is an experimental class, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.
2026/01/28 09:41:33 WARNING mlflow.models.model: `artifact_path` is deprecated. Please use `name` instead.
🏃 View run MLFlow Test at: https://uksouth.api.azureml.ms/mlflow/v2.0/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.MachineLearningServices/workspaces/<repo-name>/#/experiments/<experiment-id>/runs/<run-id>
🧪 View experiment at: https://uksouth.api.azureml.ms/mlflow/v2.0/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.MachineLearningServices/workspaces/<repo-name>/#/experiments/<experiment-id>
Traceback (most recent call last):
  File "d:\repos\<repo-name>\junk.py", line 23, in <module>
    mlflow.pytorch.log_model(
    ~~~~~~~~~~~~~~~~~~~~~~~~^
        model,
        ^^^^^^
        "pl_model",
        ^^^^^^^^^^^
        pip_requirements="requirements.txt",
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "D:\repos\<repo-name>\.venv\Lib\site-packages\mlflow\pytorch\__init__.py", line 288, in log_model
    return Model.log(
           ~~~~~~~~~^
        artifact_path=artifact_path,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<19 lines>...
        **kwargs,
        ^^^^^^^^^
    )
    ^
  File "D:\repos\<repo-name>\.venv\Lib\site-packages\mlflow\models\model.py", line 1170, in log
    model = _create_logged_model(
        # TODO: Update model name
    ...<7 lines>...
        flavor=flavor_name,
    )
  File "D:\repos\<repo-name>\.venv\Lib\site-packages\mlflow\tracking\fluent.py", line 2323, in _create_logged_model
    return MlflowClient()._create_logged_model(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        experiment_id=experiment_id,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
        flavor=flavor,
        ^^^^^^^^^^^^^^
    )
    ^
  File "D:\repos\<repo-name>\.venv\Lib\site-packages\mlflow\tracking\client.py", line 5492, in _create_logged_model
    return self._tracking_client.create_logged_model(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        experiment_id, name, source_run_id, tags, params, model_type, flavor
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "D:\repos\<repo-name>\.venv\Lib\site-packages\mlflow\telemetry\track.py", line 30, in wrapper
    result = func(*args, **kwargs)
  File "D:\repos\<repo-name>\.venv\Lib\site-packages\mlflow\tracking\_tracking_service\client.py", line 870, in create_logged_model
    return self.store.create_logged_model(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        experiment_id=experiment_id,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<8 lines>...
        model_type=model_type,
        ^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "D:\repos\<repo-name>\.venv\Lib\site-packages\mlflow\store\tracking\rest_store.py", line 894, in create_logged_model
    response_proto = self._call_endpoint(CreateLoggedModel, req_body)
  File "D:\repos\<repo-name>\.venv\Lib\site-packages\mlflow\store\tracking\rest_store.py", line 201, in _call_endpoint
    return call_endpoint(
        self.get_host_creds(),
    ...<4 lines>...
        retry_timeout_seconds=retry_timeout_seconds,
    )
  File "D:\repos\<repo-name>\.venv\Lib\site-packages\mlflow\utils\rest_utils.py", line 571, in call_endpoint
    response = verify_rest_response(response, endpoint)
  File "D:\repos\<repo-name>\.venv\Lib\site-packages\mlflow\utils\rest_utils.py", line 317, in verify_rest_response
    raise MlflowException(
    ...<2 lines>...
    )
mlflow.exceptions.MlflowException: API request to endpoint /api/2.0/mlflow/logged-models failed with error code 404 != 200. Response body: ''

Expected behavior
The model should be logged to AzureML

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Previous issues suggest downgrading MLFlow version:
#44365
https://learn.microsoft.com/en-us/answers/questions/2288377/how-to-fix-model-logging-in-mlflow

This is not an option due to critical security vulnerabilities in MLFLow

Metadata

Metadata

Labels

Machine LearningService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-author-feedbackWorkflow: More information is needed from author to address the issue.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions