You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Set up MLflow with Azure Machine Learning to deploy your ML models as an Azure web service.
4
+
description: Set up MLflow with Azure Machine Learning by using the v1 SDK and deploy machine learning models as Azure web services.
5
5
services: machine-learning
6
6
author: msakande
7
7
ms.author: mopeakande
8
8
ms.reviewer: fasantia
9
9
ms.service: machine-learning
10
10
ms.subservice: core
11
-
ms.date: 11/04/2022
11
+
ms.date: 07/16/2024
12
12
ms.topic: how-to
13
13
ms.custom: UpdateFrequency5, sdkv1
14
+
15
+
#customer intent: As a developer, I want to configure MLflow with Azure Machine Learning so I can deploy machine learning models as Azure web services.
In this article, learn how to deploy your[MLflow](https://www.mlflow.org) model as an Azure web service, so that you can leverage and apply Azure Machine Learning's model management and data drift detection capabilities to your production models. For more MLflow and Azure Machine Learning functionality integrations, see [MLflow and Azure Machine Learning (v2)](../concept-mlflow.md), which uses v2 SDK.
22
+
MLflow is an open-source library for managing the life cycle of machine learning experiments. MLflow integration with Azure Machine Learning lets you extend the management capabilities beyond model training to the deployment phase of production models. In this article, you deploy an[MLflow](https://www.mlflow.org/) model as an Azure web serviceand apply Azure Machine Learning model management and data drift detection features to your production models.
* Azure Container Instance (ACI) which is a suitable choice for a quick dev-test deployment.
24
-
* Azure Kubernetes Service (AKS) which is recommended for scalable production deployments.
24
+
The following diagram demonstrates how the MLflow deploy API integrates with Azure Machine Learning to deploy models. You create models as Azure web services by using popular frameworks like PyTorch, Tensorflow, or scikit-learn, and manage the services in your workspace:
:::image type="content" source="./media/how-to-deploy-mlflow-models/mlflow-diagram-deploy.png" border="false" alt-text="Diagram that illustrates how the MLflow deploy API integrates with Azure Machine Learning to deploy models." lightbox="./media/how-to-deploy-mlflow-models/mlflow-diagram-deploy.png":::
27
27
28
28
> [!TIP]
29
-
> The information in this document is primarily for data scientists and developers who want to deploy their MLflow model to an Azure Machine Learning web service endpoint. If you are an administrator interested in monitoring resource usage and events from Azure Machine Learning, such as quotas, completed training runs, or completed model deployments, see [Monitoring Azure Machine Learning](../monitor-azure-machine-learning.md).
29
+
> This article supports data scientists and developers who want to deploy an MLflow model to an Azure Machine Learning web service endpoint. If you're an admin who wants to monitor resource usage and events from Azure Machine Learning, such as quotas, completed training runs, or completed model deployments, see [Monitoring Azure Machine Learning](../monitor-azure-machine-learning.md).
30
30
31
-
## MLflow with Azure Machine Learning deployment
31
+
## Prerequisites
32
32
33
-
MLflow is an open-source library for managing the life cycle of your machine learning experiments. Its integration with Azure Machine Learning allows for you to extend this management beyond model training to the deployment phase of your production model.
33
+
- Train a machine learning model. If you don't have a trained model, download the notebook that best fits your compute scenario in the [Azure Machine Learning Notebooks repository](https://github.com/Azure/MachineLearningNotebooks/tree/master/how-to-use-azureml/ml-frameworks/using-mlflow) on GitHub. Follow the instructions in the notebook and run the cells to prepare the model.
34
34
35
-
The following diagram demonstrates that with the MLflow deploy API and Azure Machine Learning, you can deploy models created with popular frameworks, like PyTorch, Tensorflow, scikit-learn, etc., as Azure web services and manage them in your workspace.
35
+
-[Set up the MLflow Tracking URI to connect Azure Machine Learning](how-to-use-mlflow.md#track-runs-from-your-local-machine-or-remote-compute).
36
36
37
-

37
+
- Install the **azureml-mlflow** package. This package automatically loads the **azureml-core** definitions in the [Azure Machine Learning Python SDK](/python/api/overview/azure/ml/install), which provides the connectivity for MLflow to access your workspace.
38
38
39
-
## Prerequisites
39
+
- Confirm you have the required [access permissions for MLflow operations with your workspace](../how-to-assign-roles.md#mlflow-operations).
40
+
41
+
### Deployment options
42
+
43
+
Azure Machine Learning offers the following deployment configuration options:
44
+
45
+
- Azure Container Instances: Suitable for quick dev-test deployment.
46
+
- Azure Kubernetes Service (AKS): Recommended for scalable production deployment.
40
47
41
-
* A machine learning model. If you don't have a trained model, find the notebook example that best fits your compute scenario in [this repo](https://github.com/Azure/MachineLearningNotebooks/tree/master/how-to-use-azureml/ml-frameworks/using-mlflow) and follow its instructions.
42
-
*[Set up the MLflow Tracking URI to connect Azure Machine Learning](how-to-use-mlflow.md#track-runs-from-your-local-machine-or-remote-compute).
43
-
* Install the `azureml-mlflow` package.
44
-
* This package automatically brings in `azureml-core` of the [The Azure Machine Learning Python SDK](/python/api/overview/azure/ml/install), which provides the connectivity for MLflow to access your workspace.
45
-
* See which [access permissions you need to perform your MLflow operations with your workspace](../how-to-assign-roles.md#mlflow-operations).
For more MLflow and Azure Machine Learning functionality integrations, see [MLflow and Azure Machine Learning (v2)](../concept-mlflow.md), which uses the v2 SDK.
46
51
47
-
## Deploy to Azure Container Instance (ACI)
52
+
## Deploy to Azure Container Instances
48
53
49
54
To deploy your MLflow model to an Azure Machine Learning web service, your model must be set up with the [MLflow Tracking URI to connect with Azure Machine Learning](how-to-use-mlflow.md).
50
55
51
-
In order to deploy to ACI, you don't need to define any deployment configuration, the service will default to an ACI deployment when a config is not provided.
52
-
Then, register and deploy the model in one step with MLflow's [deploy](https://www.mlflow.org/docs/latest/python_api/mlflow.azureml.html#mlflow.azureml.deploy) method for Azure Machine Learning.
56
+
For the deployment to Azure Container Instances, you don't need to define any deployment configuration. The service defaults to an Azure Container Instances deployment when a configuration isn't provided. You can register and deploy the model in one step with MLflow's [deploy](https://www.mlflow.org/docs/latest/python_api/mlflow.azureml.html#mlflow.azureml.deploy) method for Azure Machine Learning.
57
+
58
+
<!-- Reviewer: The following cell returns an error:
If you prefer not to use the defaults, you can set up your deployment configuration with a deployment config json file that uses parameters from the [deploy_configuration()](/python/api/azureml-core/azureml.core.webservice.aciwebservice#deploy-configuration-cpu-cores-none--memory-gb-none--tags-none--properties-none--description-none--location-none--auth-enabled-none--ssl-enabled-none--enable-app-insights-none--ssl-cert-pem-file-none--ssl-key-pem-file-none--ssl-cname-none--dns-name-label-none-) method as reference.
94
+
If you prefer not to use the defaults, you can set up your deployment with a deployment config json file that uses parameters from the [deploy_configuration()](/python/api/azureml-core/azureml.core.webservice.aciwebservice#deploy-configuration-cpu-cores-none--memory-gb-none--tags-none--properties-none--description-none--location-none--auth-enabled-none--ssl-enabled-none--enable-app-insights-none--ssl-cert-pem-file-none--ssl-key-pem-file-none--ssl-cname-none--dns-name-label-none-) method as a reference.
72
95
73
-
For your deployment config json file, each of the deployment config parameters need to be defined in the form of a dictionary. The following is an example. [Learn more about what your deployment configuration json file can contain](reference-azure-machine-learning-cli.md#azure-container-instance-deployment-configuration-schema).
96
+
### Define deployment config parameters
74
97
98
+
In your deployment config json file, you define each deployment config parameter in the form of a dictionary. The following snippet provides an example. For more information about what your deployment configuration json file can contain, see the [Azure Container instance deployment configuration schema](reference-azure-machine-learning-cli.md#azure-container-instance-deployment-configuration-schema) in the Azure Machine Learning Azure CLI reference.
To deploy your MLflow model to an Azure Machine Learning web service, your model must be set up with the [MLflow Tracking URI to connect with Azure Machine Learning](how-to-use-mlflow.md).
100
120
101
-
To deploy to AKS, first create an AKS cluster. Create an AKS cluster using the [ComputeTarget.create()](/python/api/azureml-core/azureml.core.computetarget#create-workspace--name--provisioning-configuration-) method. It may take 20-25 minutes to create a new cluster.
121
+
For deployment to AKS, you first create an AKS cluster by using the [ComputeTarget.create()](/python/api/azureml-core/azureml.core.computetarget#create-workspace--name--provisioning-configuration-) method. This process can take 20-25 minutes to create a new cluster.
102
122
103
123
```python
104
124
from azureml.core.compute import AksCompute, ComputeTarget
Create a deployment config json using [deploy_configuration()](/python/api/azureml-core/azureml.core.webservice.aks.aksservicedeploymentconfiguration#parameters) method values as a reference. Each of the deployment config parameters simply need to be defined as a dictionary. Here's an example below:
139
+
140
+
Create a deployment config json by using the [deploy_configuration()](/python/api/azureml-core/azureml.core.webservice.aks.aksservicedeploymentconfiguration#parameters) method values as a reference. Define each deployment config parameter as a dictionary, as demonstrated in the following example:
Then, register and deploy the model in one step with MLflow's[deployment client](https://www.mlflow.org/docs/latest/python_api/mlflow.deployments.html).
146
+
Then, register and deploy the model in a single step with the MLflow [deployment client](https://www.mlflow.org/docs/latest/python_api/mlflow.deployments.html):
If you don't plan to use your deployed web service, use `service.delete()` to delete it from your notebook. For more information, see the documentation for [WebService.delete()](/python/api/azureml-core/azureml.core.webservice%28class%29#delete--).
170
+
If you don't plan to use your deployed web service, use the `service.delete()`method to delete the service from your notebook. For more information, see the [delete() method of the WebService Class](/python/api/azureml-core/azureml.core.webservice%28class%29#azureml-core-webservice-delete) in the Python SDK documentation.
154
171
155
-
## Example notebooks
172
+
## Explore example notebooks
156
173
157
174
The [MLflow with Azure Machine Learning notebooks](https://github.com/Azure/MachineLearningNotebooks/tree/master/how-to-use-azureml/ml-frameworks/using-mlflow) demonstrate and expand upon concepts presented in this article.
158
175
159
176
> [!NOTE]
160
-
> A community-driven repository of examples using mlflow can be found at https://github.com/Azure/azureml-examples.
177
+
> For a community-driven repository of examples that use MLflow, see the [Azure Machine Learning examples repository](https://github.com/Azure/azureml-examples) on GitHub.
161
178
162
-
## Next steps
179
+
## Related content
163
180
164
-
*[Manage your models](concept-model-management-and-deployment.md).
165
-
* Monitor your production models for [data drift](how-to-enable-data-collection.md).
166
-
*[Track Azure Databricks runs with MLflow](../how-to-use-mlflow-azure-databricks.md).
181
+
-[Manage, deploy, and monitor models with Azure Machine Learning v1](concept-model-management-and-deployment.md)
182
+
-[Detect data drift (preview) on datasets](how-to-monitor-datasets.md)
183
+
-[Track Azure Databricks experiment runs with MLflow](../how-to-use-mlflow-azure-databricks.md)
0 commit comments