databricksopen-sourcemlflowartifacts

How to enable User Authentication in MLFLOW?


I'm trying to enable MLFLOW user based authentication in Local Linux server using python

Able to start the server the mlflow server with the following command :

mlflow server --backend-store-uri sqlite:///mlflow.db --default-artifact-root ./artifacts --host 0.0.0.0

But wasn't able to find any kind of authentication setup available when starting a server

Expectation:

Need a server web interface with Username and Password based authentication

Suggestions and Appropriate solutions are much appreciated


Solution

  • You can use mlflow's basic authentication: Provide a basic_auth.ini file similar to this

    [mlflow]
    default_permission = READ
    database_uri = sqlite:///basic_auth.db
    admin_username = admin
    admin_password = SuperSecurePassword
    

    and add --app-name basic-auth to mlflow

    mlflow server --backend-store-uri sqlite:///mlflow.db --default-artifact-root ./artifacts --host 0.0.0.0 --app-name basic-auth
    

    basic_auth.ini needs to be in mlflow/server/auth/ under the site-packages directory, so for example /usr/local/lib/python3.10/site-packages/mlflow/server/auth/basic_auth.ini

    You can find the correct site-packages directory with python -c 'import mlflow;print(mlflow.__path__)'