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
To connect MLflow to an Azure Machine Learning workspace, you need the tracking URI for the workspace. Each workspace has its own tracking URI and it has the protocol `azureml://`.
36
+
To connect MLflow to an Azure Machine Learning workspace, you need the tracking URI of the workspace. Each workspace has its own tracking URI, which starts with the protocol `azureml://`.
Copy file name to clipboardExpand all lines: articles/machine-learning/includes/machine-learning-mlflow-configure-tracking.md
+58-51Lines changed: 58 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,14 +12,14 @@ ms.author: fasantia
12
12
13
13
[!INCLUDE [cli v2](machine-learning-cli-v2.md)]
14
14
15
-
1.Login and configure your workspace:
15
+
1.Sign in and configure your workspace:
16
16
17
17
```bash
18
18
az account set --subscription <subscription>
19
19
az configure --defaults workspace=<workspace> group=<resource-group> location=<location>
20
20
```
21
21
22
-
1. You can get the tracking URI using the `az ml workspace` command:
22
+
1. Get the tracking URI by using the `az ml workspace` command:
23
23
24
24
```bash
25
25
az ml workspace show --query mlflow_tracking_uri
@@ -29,93 +29,99 @@ ms.author: fasantia
29
29
30
30
[!INCLUDE [sdk v2](machine-learning-sdk-v2.md)]
31
31
32
-
You can get the Azure ML MLflow tracking URI using the [Azure Machine Learning SDK v2 forPython](../concept-v2.md). Ensure you have the library `azure-ai-ml` installedinthe compute you are using. The following sample gets the unique MLFLow tracking URI associated with your workspace.
32
+
You can use the [Azure Machine Learning SDK v2 forPython](../concept-v2.md) to get the Azure Machine Learning MLflow tracking URI. Ensure that the `azure-ai-ml` library is installedinyour compute instance. Then use the following code to get the unique MLFLow tracking URI that's associated with your workspace.
33
33
34
-
1. Login into your workspace using the `MLClient`. The easier way to do that is by using the workspace config file:
34
+
1. Use an instance of `MLClient` to sign in to your workspace. There are two options for signing in:
35
35
36
-
```python
37
-
from azure.ai.ml import MLClient
38
-
from azure.identity import DefaultAzureCredential
36
+
- The easiest way is to use the workspace configuration file:
- Alternatively, you can use your subscription ID, resource group name, and workspace name to sign in:
55
+
56
+
```python
57
+
from azure.ai.ml import MLClient
58
+
from azure.identity import DefaultAzureCredential
59
+
60
+
# Enter information about your Azure Machine Learning workspace.
61
+
subscription_id = '<subscription-ID>'
62
+
resource_group = '<resource-group-name>'
63
+
workspace_name = '<workspace-name>'
65
64
66
-
> [!IMPORTANT]
67
-
>`DefaultAzureCredential` will try to pull the credentials from the available context. If you want to specify credentials in a different way, forinstance using the web browserin an interactive way, you can use `InteractiveBrowserCredential` or any other method available in [`azure.identity`](https://pypi.org/project/azure-identity/) package.
> The `DefaultAzureCredential` method tries to pull credentials from the available context. But you might want to specify credentials in a different way, for instance by using the web browser in an interactive way. In these cases, you can use `InteractiveBrowserCredential` or any other method available in the [`azure.identity`](https://pypi.org/project/azure-identity/) package.
Use the Azure Machine Learning portal to get the tracking URI:
82
+
Use Azure Machine Learning studio to get the tracking URI:
78
83
79
-
1. Open the [Azure Machine Learning studio portal](https://ml.azure.com) and log in using your credentials.
80
-
81
-
1. In the upper right corner, click on the name of your workspace to show the __Directory + Subscription + Workspace__ blade.
82
-
83
-
1. Click on __View all properties in Azure Portal__.
84
+
1. Open [Azure Machine Learning studio](https://ml.azure.com) and use your credentials to sign in.
84
85
85
-
1. On the __Essentials__ section, you will find the property __MLflow tracking URI__.
86
+
1. In the upper right corner, select the name of your workspace.
86
87
88
+
1. In the Directory + Subscription + Workspace window, select __View all properties in Azure Portal__. The resource page for your workspace opens in the Azure portal.
89
+
90
+
1. Under __Essentials__, copy the __MLflow tracking URI__ value.
87
91
88
92
# [Manually](#tab/manual)
89
93
90
-
The Azure Machine Learning Tracking URI can be constructed using the subscription ID, region of where the resource is deployed, resource group name and workspace name. The following code sample shows how:
94
+
You can construct the Azure Machine Learning tracking URI manually. You need your subscription ID, the region your workspace is deployed in, your resource group name, and your workspace name. To get the URI, enter those values into the following code:
91
95
92
96
> [!WARNING]
93
-
> If you are working ina private link-enabled workspace, the MLflow endpoint will also use a private link to communicate with Azure Machine Learning. As a consequence, the tracking URI will look different as proposed here. You need to get the tracking URI using the Azure ML SDK or CLI v2 on those cases.
97
+
> If you use a private link-enabled workspace, the MLflow endpoint also uses a private link to communicate with Azure Machine Learning. As a result, the tracking URI uses a format that's different from the one in this article. In this case, you need to use the Azure Machine Learning SDK for Python or the Azure Machine Learning CLI v2 to get the tracking URI.
Then the method [`set_tracking_uri()`](https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.set_tracking_uri) points the MLflow tracking URI to that URI.
114
+
Use the [`set_tracking_uri()`](https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.set_tracking_uri) method to setthe MLflow tracking URI to the tracking URI of your workspace.
109
115
110
116
```python
111
117
import mlflow
112
118
113
119
mlflow.set_tracking_uri(mlflow_tracking_uri)
114
120
```
115
121
116
-
# [Using environment variables](#tab/environ)
122
+
# [Environment variables](#tab/environ)
117
123
118
-
You can setthe MLflow environment variables [MLFLOW_TRACKING_URI](https://mlflow.org/docs/latest/tracking.html#logging-to-a-tracking-server) in your compute to make any interaction with MLflow in that compute to point by default to Azure Machine Learning.
124
+
In your compute instance, use the following code to set the [MLFLOW_TRACKING_URI](https://mlflow.org/docs/latest/tracking.html#logging-to-a-tracking-server) MLflow environment variable to the tracking URI of your workspace. This assignment makes all interactions with MLflow in that compute instance point to Azure Machine Learning by default.
119
125
120
126
```bash
121
127
MLFLOW_TRACKING_URI=$(az ml workspace show --query mlflow_tracking_uri | sed 's/"//g')
@@ -124,4 +130,5 @@ ms.author: fasantia
124
130
---
125
131
126
132
> [!TIP]
127
-
> When working on shared environments, like an Azure Databricks cluster, Azure Synapse Analytics cluster, or similar, it is useful to set the environment variable `MLFLOW_TRACKING_URI` at the cluster level to automatically configure the MLflow tracking URI to point to Azure Machine Learning forall the sessions runningin the cluster rather than to do it on a per-session basis.
133
+
>
134
+
> Some scenarios involve working in a shared environment like an Azure Databricks cluster or an Azure Synapse Analytics cluster. In these cases, it's useful to set the `MLFLOW_TRACKING_URI` environment variable at the cluster level rather than for each session. Setting the variable at the cluster level automatically configures the MLflow tracking URI to point to Azure Machine Learning for all sessions in the cluster.
0 commit comments