Access the MLflow tracking server from outside Azure Databricks

You can configure a standalone environment to enable MLflow applications running in that environment to log to your Azure Databricks hosted MLflow tracking server and the MLflow CLI to communicate with the tracking server.

This article describes the required configuration steps. To access the MLflow tracking server, do Step 0 to install MLflow and configure your credentials, and then do Step 1a to configure your application or Step 1b to configure the MLflow CLI.

For information on how to launch and log to an open-source tracking server, see the open source documentation.

Step 0: Configure your environment

If you don’t have a Azure Databricks Workspace, you can try Databricks for free.

To configure your environment to access your Azure Databricks hosted MLflow tracking server:

  1. Install MLflow using pip install mlflow.
  2. Configure authentication. Do one of:
    • Generate a REST API token and create a credentials file using databricks configure --token.

    • Specify credentials via environment variables:

      # Configure MLflow to communicate with a Databricks-hosted tracking server
      export MLFLOW_TRACKING_URI=databricks
      # Specify the workspace hostname and token
      export DATABRICKS_HOST="..."
      export DATABRICKS_TOKEN="..."
      

Step 1a: Configure MLflow applications

Configure MLflow applications to log to Azure Databricks by setting the tracking URI to databricks, or databricks://<profileName>, if you specified a profile name via --profile while creating your credentials file. For example, you can achieve this by setting the MLFLOW_TRACKING_URI environment variable to “databricks”.

Step 1b: Configure the MLflow CLI

Configure the MLflow CLI to communicate with an Azure Databricks tracking server with the MLFLOW_TRACKING_URI environment variable. For example, to create an experiment using the CLI with the tracking URI databricks, run:

# Replace <your-username> with your Databricks username
export MLFLOW_TRACKING_URI=databricks
mlflow experiments create -n /Users/<your-username>/my-experiment