Skip to content

Commit 33f5dee

Browse files
Formatting and minor fixes.
1 parent 3de9c16 commit 33f5dee

File tree

2 files changed

+53
-51
lines changed

2 files changed

+53
-51
lines changed

articles/machine-learning/how-to-use-mlflow-azure-databricks.md

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ To link your Azure Databricks workspace to a new or existing Azure Machine Learn
7373
1. Navigate to your Azure Databricks workspace **Overview** page.
7474
1. Select **Link Azure Machine Learning workspace**.
7575

76-
:::image type="content" source="./media/how-to-use-mlflow-azure-databricks/link-workspaces.png" alt-text="Screenshot shows the Link Azure Databricks and Azure Machine Learning workspaces option.":::
76+
:::image type="content" source="./media/how-to-use-mlflow-azure-databricks/link-workspaces.png" lightbox="./media/how-to-use-mlflow-azure-databricks/link-workspaces.png" alt-text="Screenshot shows the Link Azure Databricks and Azure Machine Learning workspaces option.":::
7777

7878
After you link your Azure Databricks workspace with your Azure Machine Learning workspace, MLflow Tracking is automatically tracked in the following places:
7979

@@ -109,71 +109,71 @@ Configure the MLflow tracking URI to point exclusively to Azure Machine Learning
109109

110110
1. Get the tracking URI for your workspace:
111111

112-
# [Azure CLI](#tab/cli)
112+
# [Azure CLI](#tab/cli)
113113

114114
[!INCLUDE [cli v2](includes/machine-learning-cli-v2.md)]
115115

116-
1. Sign in and configure your workspace:
116+
1. Sign in and configure your workspace:
117117

118118
```bash
119119
az account set --subscription <subscription>
120120
az configure --defaults workspace=<workspace> group=<resource-group> location=<location>
121121
```
122122

123-
1. You can get the tracking URI using the `az ml workspace` command:
123+
1. You can get the tracking URI using the `az ml workspace` command:
124124

125125
```bash
126126
az ml workspace show --query mlflow_tracking_uri
127127
```
128128

129-
# [Python](#tab/python)
129+
# [Python](#tab/python)
130130

131-
[!INCLUDE [sdk v2](includes/machine-learning-sdk-v2.md)]
131+
[!INCLUDE [sdk v2](includes/machine-learning-sdk-v2.md)]
132132

133133
You can get the Azure Machine Learning MLflow tracking URI using the [Azure Machine Learning SDK v2 for Python](concept-v2.md). Ensure you have the library `azure-ai-ml` installed in the compute you're using. The following sample gets the unique MLFLow tracking URI associated with your workspace.
134134

135-
1. Sign in into your workspace using the `MLClient`. The easier way to do that is by using the workspace config file:
135+
1. Sign in into your workspace using the `MLClient`. The easier way to do that is by using the workspace config file:
136136

137-
```python
138-
from azure.ai.ml import MLClient
139-
from azure.identity import DefaultAzureCredential
137+
```python
138+
from azure.ai.ml import MLClient
139+
from azure.identity import DefaultAzureCredential
140140

141141
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
142-
```
142+
```
143143

144-
> [!TIP]
145-
> To download the workspace configuration file:
146-
>
147-
> 1. Navigate to [Azure Machine Learning studio](https://ml.azure.com)
148-
> 1. Click on the upper-right corner of the page -> Download config file.
149-
> 1. Save the file `config.json` in the same directory where you are working on.
144+
> [!TIP]
145+
> To download the workspace configuration file:
146+
>
147+
> 1. Navigate to [Azure Machine Learning studio](https://ml.azure.com)
148+
> 1. Click on the upper-right corner of the page -> Download config file.
149+
> 1. Save the file `config.json` in the same directory where you are working on.
150150
151-
Alternatively, you can use the subscription ID, resource group name, and workspace name to get it:
151+
Alternatively, you can use the subscription ID, resource group name, and workspace name to get it:
152152

153-
```python
154-
from azure.ai.ml import MLClient
155-
from azure.identity import DefaultAzureCredential
153+
```python
154+
from azure.ai.ml import MLClient
155+
from azure.identity import DefaultAzureCredential
156156

157-
#Enter details of your Azure Machine Learning workspace
158-
subscription_id = '<SUBSCRIPTION_ID>'
159-
resource_group = '<RESOURCE_GROUP>'
160-
workspace_name = '<WORKSPACE_NAME>'
157+
#Enter details of your Azure Machine Learning workspace
158+
subscription_id = '<SUBSCRIPTION_ID>'
159+
resource_group = '<RESOURCE_GROUP>'
160+
workspace_name = '<WORKSPACE_NAME>'
161161

162-
ml_client = MLClient(credential=DefaultAzureCredential(),
163-
subscription_id=subscription_id,
164-
resource_group_name=resource_group)
165-
```
162+
ml_client = MLClient(credential=DefaultAzureCredential(),
163+
subscription_id=subscription_id,
164+
resource_group_name=resource_group)
165+
```
166166

167-
> [!IMPORTANT]
168-
> `DefaultAzureCredential` tries to pull the credentials from the available context. If you want to specify credentials in a different way, for instance using the web browser in an interactive way, you can use `InteractiveBrowserCredential` or any other method available in [`azure.identity`](https://pypi.org/project/azure-identity/) package.
167+
> [!IMPORTANT]
168+
> `DefaultAzureCredential` tries to pull the credentials from the available context. If you want to specify credentials in a different way, for instance using the web browser in an interactive way, you can use `InteractiveBrowserCredential` or any other method available in [`azure.identity`](https://pypi.org/project/azure-identity/) package.
169169
170-
1. Get the Azure Machine Learning Tracking URI:
170+
1. Get the Azure Machine Learning Tracking URI:
171171

172-
```python
173-
mlflow_tracking_uri = ml_client.workspaces.get(ml_client.workspace_name).mlflow_tracking_uri
174-
```
172+
```python
173+
mlflow_tracking_uri = ml_client.workspaces.get(ml_client.workspace_name).mlflow_tracking_uri
174+
```
175175

176-
# [Studio](#tab/studio)
176+
# [Studio](#tab/studio)
177177

178178
Use the Azure Machine Learning portal to get the tracking URI:
179179

@@ -182,7 +182,7 @@ Configure the MLflow tracking URI to point exclusively to Azure Machine Learning
182182
1. Select **View all properties in Azure Portal**.
183183
1. On the **Essentials** section, find the property **MLflow tracking URI**.
184184

185-
# [Manually](#tab/manual)
185+
# [Manually](#tab/manual)
186186

187187
You can construct the Azure Machine Learning Tracking URI using the subscription ID, region of where the resource is deployed, resource group name, and workspace name. The following code sample shows how:
188188

@@ -198,11 +198,11 @@ Configure the MLflow tracking URI to point exclusively to Azure Machine Learning
198198
mlflow_tracking_uri = f"azureml://{region}.api.azureml.ms/mlflow/v1.0/subscriptions/{subscription_id}/resourceGroups/{resource_group}/providers/Microsoft.MachineLearningServices/workspaces/{workspace_name}"
199199
```
200200

201-
---
201+
---
202202

203203
1. Configuring the tracking URI:
204204

205-
# [Using MLflow SDK](#tab/mlflow)
205+
# [Use MLflow SDK](#tab/mlflow)
206206

207207
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.
208208

@@ -212,40 +212,40 @@ Configure the MLflow tracking URI to point exclusively to Azure Machine Learning
212212
mlflow.set_tracking_uri(mlflow_tracking_uri)
213213
```
214214

215-
# [Using environment variables](#tab/environ)
215+
# [Use environment variables](#tab/environ)
216216

217217
You can set the 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 the compute to point by default to Azure Machine Learning.
218218

219219
```bash
220220
MLFLOW_TRACKING_URI=$(az ml workspace show --query mlflow_tracking_uri | sed 's/"//g')
221221
```
222222

223-
---
223+
---
224224

225-
> [!TIP]
226-
> When working with shared environments, like an Azure Databricks cluster, Azure Synapse Analytics cluster, or similar, you can set the environment variable `MLFLOW_TRACKING_URI` at the cluster level. This approach allows you to automatically configure the MLflow tracking URI to point to Azure Machine Learning for all the sessions that run in the cluster rather than to do it on a per-session basis.
227-
>
228-
> :::image type="content" source="./media/how-to-use-mlflow-azure-databricks/env.png" alt-text="Screenshot shows Acvanced options where you can configure the environment variables in an Azure Databricks cluster.":::
229-
>
230-
> After you configure the environment variable, any experiment running in such cluster is tracked in Azure Machine Learning.
225+
> [!TIP]
226+
> When working with shared environments, like an Azure Databricks cluster, Azure Synapse Analytics cluster, or similar, you can set the environment variable `MLFLOW_TRACKING_URI` at the cluster level. This approach allows you to automatically configure the MLflow tracking URI to point to Azure Machine Learning for all the sessions that run in the cluster rather than to do it on a per-session basis.
227+
>
228+
> :::image type="content" source="./media/how-to-use-mlflow-azure-databricks/env.png" alt-text="Screenshot shows Acvanced options where you can configure the environment variables in an Azure Databricks cluster.":::
229+
>
230+
> After you configure the environment variable, any experiment running in such cluster is tracked in Azure Machine Learning.
231231
232232
#### Configure authentication
233233

234234
After you configure tracking, configure how to authenticate to the associated workspace. By default, the Azure Machine Learning plugin for MLflow opens a browser to interactively prompt for credentials. For other ways to configure authentication for MLflow in Azure Machine Learning workspaces, see [Configure MLflow for Azure Machine Learning: Configure authentication](how-to-use-mlflow-configure-tracking.md#configure-authentication).
235235

236236
[!INCLUDE [configure-mlflow-auth](includes/machine-learning-mlflow-configure-auth.md)]
237237

238-
#### Experiment's names in Azure Machine Learning
238+
#### Experiment names in Azure Machine Learning
239239

240-
When you configure MLflow to exclusively track experiments in Azure Machine Learning workspace, the experiment's naming convention has to follow the one used by Azure Machine Learning. In Azure Databricks, experiments are named with the path to where the experiment is saved, for instance `/Users/[email protected]/iris-classifier`. However, in Azure Machine Learning, you provide the experiment name directly. The same experiment would be named `iris-classifier` directly:
240+
When you configure MLflow to exclusively track experiments in Azure Machine Learning workspace, the experiment naming convention has to follow the one used by Azure Machine Learning. In Azure Databricks, experiments are named with the path to where the experiment is saved, for instance `/Users/[email protected]/iris-classifier`. However, in Azure Machine Learning, you provide the experiment name directly. The same experiment would be named `iris-classifier` directly:
241241

242242
```python
243243
mlflow.set_experiment(experiment_name="experiment-name")
244244
```
245245

246246
#### Tracking parameters, metrics and artifacts
247247

248-
After this configuration, you can use MLflow in Azure Databricks in the same way as you're used to. For details see [Log & view metrics and log files](how-to-log-view-metrics.md).
248+
After this configuration, you can use MLflow in Azure Databricks in the same way as you're used to. For more information, see [Log & view metrics and log files](how-to-log-view-metrics.md).
249249

250250
## Logging models with MLflow
251251

articles/machine-learning/includes/machine-learning-mlflow-configure-auth.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ export AZURE_CLIENT_SECRET="<AZURE_CLIENT_SECRET>"
3434
---
3535

3636
> [!TIP]
37-
> When working on shared environments, we recommend that you configure these environment variables at the compute. As a best practice, manage them as secrets in an instance of Azure Key Vault. For instance, in Azure Databricks you can use secrets in environment variables as follows in the cluster configuration: `AZURE_CLIENT_SECRET={{secrets/<scope-name>/<secret-name>}}`. For more information about implementing this approach in Azure Databricks, see [Reference a secret in an environment variable](/azure/databricks/security/secrets/secrets#reference-a-secret-in-an-environment-variable) or refer to documentation for your platform.
37+
> When working on shared environments, we recommend that you configure these environment variables at the compute. As a best practice, manage them as secrets in an instance of Azure Key Vault.
38+
>
39+
> For instance, in Azure Databricks you can use secrets in environment variables as follows in the cluster configuration: `AZURE_CLIENT_SECRET={{secrets/<scope-name>/<secret-name>}}`. For more information about implementing this approach in Azure Databricks, see [Reference a secret in an environment variable](/azure/databricks/security/secrets/secrets#reference-a-secret-in-an-environment-variable) or refer to documentation for your platform.

0 commit comments

Comments
 (0)