Skip to content

Commit b36db53

Browse files
Merge pull request #6123 from s-polly/stp_ml-client-7-18
updated usage of MLClient.from_config
2 parents 3bc673b + 29c38ea commit b36db53

7 files changed

+29
-23
lines changed

articles/machine-learning/how-to-access-data-batch-endpoints-jobs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Use the Azure Machine Learning SDK for Python to sign in:
5959
from azure.ai.ml import MLClient
6060
from azure.identity import DefaultAzureCredential
6161

62-
ml_client = MLClient.from_config(DefaultAzureCredential())
62+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
6363
```
6464

6565
If your configuration runs outside an Azure Machine Learning compute instance, you need to specify the workspace where the endpoint is deployed:

articles/machine-learning/how-to-datastore.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ In this article, you learn how to connect to Azure data storage services with Az
3636
```python
3737
from azure.ai.ml.entities import AzureBlobDatastore
3838
from azure.ai.ml import MLClient
39+
from azure.identity import DefaultAzureCredential
3940

40-
ml_client = MLClient.from_config()
41+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
4142

4243
store = AzureBlobDatastore(
4344
name="",
@@ -55,8 +56,9 @@ ml_client.create_or_update(store)
5556
from azure.ai.ml.entities import AzureBlobDatastore
5657
from azure.ai.ml.entities import AccountKeyConfiguration
5758
from azure.ai.ml import MLClient
59+
from azure.identity import DefaultAzureCredential
5860

59-
ml_client = MLClient.from_config()
61+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
6062

6163
store = AzureBlobDatastore(
6264
name="blob_protocol_example",
@@ -78,8 +80,9 @@ ml_client.create_or_update(store)
7880
from azure.ai.ml.entities import AzureBlobDatastore
7981
from azure.ai.ml.entities import SasTokenConfiguration
8082
from azure.ai.ml import MLClient
83+
from azure.identity import DefaultAzureCredential
8184

82-
ml_client = MLClient.from_config()
85+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
8386

8487
store = AzureBlobDatastore(
8588
name="blob_sas_example",
@@ -163,8 +166,9 @@ az ml datastore create --file my_blob_datastore.yml
163166
```python
164167
from azure.ai.ml.entities import AzureDataLakeGen2Datastore
165168
from azure.ai.ml import MLClient
169+
from azure.identity import DefaultAzureCredential
166170

167-
ml_client = MLClient.from_config()
171+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
168172

169173
store = AzureDataLakeGen2Datastore(
170174
name="",
@@ -183,8 +187,9 @@ from azure.ai.ml.entities import AzureDataLakeGen2Datastore
183187
from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials
184188

185189
from azure.ai.ml import MLClient
190+
from azure.identity import DefaultAzureCredential
186191

187-
ml_client = MLClient.from_config()
192+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
188193

189194
store = AzureDataLakeGen2Datastore(
190195
name="adls_gen2_example",
@@ -252,8 +257,9 @@ az ml datastore create --file my_adls_datastore.yml
252257
from azure.ai.ml.entities import AzureFileDatastore
253258
from azure.ai.ml.entities import AccountKeyConfiguration
254259
from azure.ai.ml import MLClient
260+
from azure.identity import DefaultAzureCredential
255261

256-
ml_client = MLClient.from_config()
262+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
257263

258264
store = AzureFileDatastore(
259265
name="file_example",
@@ -274,8 +280,9 @@ ml_client.create_or_update(store)
274280
from azure.ai.ml.entities import AzureFileDatastore
275281
from azure.ai.ml.entities import SasTokenConfiguration
276282
from azure.ai.ml import MLClient
283+
from azure.identity import DefaultAzureCredential
277284

278-
ml_client = MLClient.from_config()
285+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
279286

280287
store = AzureFileDatastore(
281288
name="file_sas_example",
@@ -340,8 +347,9 @@ az ml datastore create --file my_files_datastore.yml
340347
```python
341348
from azure.ai.ml.entities import AzureDataLakeGen1Datastore
342349
from azure.ai.ml import MLClient
350+
from azure.identity import DefaultAzureCredential
343351

344-
ml_client = MLClient.from_config()
352+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
345353

346354
store = AzureDataLakeGen1Datastore(
347355
name="",
@@ -358,8 +366,9 @@ ml_client.create_or_update(store)
358366
from azure.ai.ml.entities import AzureDataLakeGen1Datastore
359367
from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials
360368
from azure.ai.ml import MLClient
369+
from azure.identity import DefaultAzureCredential
361370

362-
ml_client = MLClient.from_config()
371+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
363372

364373
store = AzureDataLakeGen1Datastore(
365374
name="adls_gen1_example",
@@ -445,8 +454,9 @@ You will then find "Endpoint", "Workspace GUID" and "Artifact GUID" in "URL" and
445454
```python
446455
from azure.ai.ml.entities import OneLakeDatastore, OneLakeArtifact
447456
from azure.ai.ml import MLClient
457+
from azure.identity import DefaultAzureCredential
448458

449-
ml_client = MLClient.from_config()
459+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
450460

451461
store = OneLakeDatastore(
452462
name="onelake_example_id",
@@ -465,16 +475,12 @@ ml_client.create_or_update(store)
465475
# [Python SDK: Service principal](#tab/sdk-onelake-sp)
466476

467477
```python
468-
from azure.ai.ml.entities import AzureDataLakeGen1Datastore
478+
from azure.ai.ml.entities import OneLakeDatastore, OneLakeArtifact
469479
from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials
470480
from azure.ai.ml import MLClient
481+
from azure.identity import DefaultAzureCredential
471482

472-
ml_client = MLClient.from_config()
473-
474-
rom azure.ai.ml.entities import OneLakeDatastore, OneLakeArtifact
475-
from azure.ai.ml import MLClient
476-
477-
ml_client = MLClient.from_config()
483+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
478484

479485
store = OneLakeDatastore(
480486
name="onelake_example_sp",

articles/machine-learning/how-to-package-models-app-service.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Follow these steps to prepare your system.
8787
1. If you're running in an Azure Machine Learning compute instance, create an `MLClient` as follows:
8888
8989
```python
90-
ml_client = MLClient.from_config(DefaultAzureCredential())
90+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
9191
```
9292
9393
Otherwise, configure workspace details and get a handle to the workspace:

articles/machine-learning/how-to-package-models-moe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ The workspace is the top-level resource for Azure Machine Learning, providing a
8282
2. If you're running in a compute instance in Azure Machine Learning, create an `MLClient` as follows:
8383

8484
```python
85-
ml_client = MLClient.from_config(DefaultAzureCredential())
85+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
8686
```
8787

8888
Otherwise, configure your workspace details and get a handle to the workspace:

articles/machine-learning/how-to-package-models.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ The workspace is the top-level resource for Azure Machine Learning, providing a
9999
2. If you're running in a compute instance in Azure Machine Learning, create an `MLClient` as follows:
100100

101101
```python
102-
ml_client = MLClient.from_config(DefaultAzureCredential())
102+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
103103
```
104104

105105
Otherwise, configure your workspace details and get a handle to the workspace:

articles/machine-learning/migrate-to-v2-command-job.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ This article gives a comparison of scenario(s) in SDK v1 and SDK v2.
6161
from azure.identity import DefaultAzureCredential
6262

6363
#connect to the workspace
64-
ml_client = MLClient.from_config(DefaultAzureCredential())
64+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
6565

6666
# set up pytorch environment
6767
env = Environment(

articles/machine-learning/migrate-to-v2-local-runs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ This article gives a comparison of scenario(s) in SDK v1 and SDK v2.
5757
from azure.identity import DefaultAzureCredential
5858

5959
#connect to the workspace
60-
ml_client = MLClient.from_config(DefaultAzureCredential())
60+
ml_client = MLClient.from_config(credential=DefaultAzureCredential())
6161

6262
# set up pytorch environment
6363
env = Environment(

0 commit comments

Comments
 (0)