@@ -36,8 +36,9 @@ In this article, you learn how to connect to Azure data storage services with Az
36
36
``` python
37
37
from azure.ai.ml.entities import AzureBlobDatastore
38
38
from azure.ai.ml import MLClient
39
+ from azure.identity import DefaultAzureCredential
39
40
40
- ml_client = MLClient.from_config()
41
+ ml_client = MLClient.from_config(credential = DefaultAzureCredential() )
41
42
42
43
store = AzureBlobDatastore(
43
44
name = " " ,
@@ -55,8 +56,9 @@ ml_client.create_or_update(store)
55
56
from azure.ai.ml.entities import AzureBlobDatastore
56
57
from azure.ai.ml.entities import AccountKeyConfiguration
57
58
from azure.ai.ml import MLClient
59
+ from azure.identity import DefaultAzureCredential
58
60
59
- ml_client = MLClient.from_config()
61
+ ml_client = MLClient.from_config(credential = DefaultAzureCredential() )
60
62
61
63
store = AzureBlobDatastore(
62
64
name = " blob_protocol_example" ,
@@ -78,8 +80,9 @@ ml_client.create_or_update(store)
78
80
from azure.ai.ml.entities import AzureBlobDatastore
79
81
from azure.ai.ml.entities import SasTokenConfiguration
80
82
from azure.ai.ml import MLClient
83
+ from azure.identity import DefaultAzureCredential
81
84
82
- ml_client = MLClient.from_config()
85
+ ml_client = MLClient.from_config(credential = DefaultAzureCredential() )
83
86
84
87
store = AzureBlobDatastore(
85
88
name = " blob_sas_example" ,
@@ -163,8 +166,9 @@ az ml datastore create --file my_blob_datastore.yml
163
166
``` python
164
167
from azure.ai.ml.entities import AzureDataLakeGen2Datastore
165
168
from azure.ai.ml import MLClient
169
+ from azure.identity import DefaultAzureCredential
166
170
167
- ml_client = MLClient.from_config()
171
+ ml_client = MLClient.from_config(credential = DefaultAzureCredential() )
168
172
169
173
store = AzureDataLakeGen2Datastore(
170
174
name = " " ,
@@ -183,8 +187,9 @@ from azure.ai.ml.entities import AzureDataLakeGen2Datastore
183
187
from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials
184
188
185
189
from azure.ai.ml import MLClient
190
+ from azure.identity import DefaultAzureCredential
186
191
187
- ml_client = MLClient.from_config()
192
+ ml_client = MLClient.from_config(credential = DefaultAzureCredential() )
188
193
189
194
store = AzureDataLakeGen2Datastore(
190
195
name = " adls_gen2_example" ,
@@ -252,8 +257,9 @@ az ml datastore create --file my_adls_datastore.yml
252
257
from azure.ai.ml.entities import AzureFileDatastore
253
258
from azure.ai.ml.entities import AccountKeyConfiguration
254
259
from azure.ai.ml import MLClient
260
+ from azure.identity import DefaultAzureCredential
255
261
256
- ml_client = MLClient.from_config()
262
+ ml_client = MLClient.from_config(credential = DefaultAzureCredential() )
257
263
258
264
store = AzureFileDatastore(
259
265
name = " file_example" ,
@@ -274,8 +280,9 @@ ml_client.create_or_update(store)
274
280
from azure.ai.ml.entities import AzureFileDatastore
275
281
from azure.ai.ml.entities import SasTokenConfiguration
276
282
from azure.ai.ml import MLClient
283
+ from azure.identity import DefaultAzureCredential
277
284
278
- ml_client = MLClient.from_config()
285
+ ml_client = MLClient.from_config(credential = DefaultAzureCredential() )
279
286
280
287
store = AzureFileDatastore(
281
288
name = " file_sas_example" ,
@@ -340,8 +347,9 @@ az ml datastore create --file my_files_datastore.yml
340
347
``` python
341
348
from azure.ai.ml.entities import AzureDataLakeGen1Datastore
342
349
from azure.ai.ml import MLClient
350
+ from azure.identity import DefaultAzureCredential
343
351
344
- ml_client = MLClient.from_config()
352
+ ml_client = MLClient.from_config(credential = DefaultAzureCredential() )
345
353
346
354
store = AzureDataLakeGen1Datastore(
347
355
name = " " ,
@@ -358,8 +366,9 @@ ml_client.create_or_update(store)
358
366
from azure.ai.ml.entities import AzureDataLakeGen1Datastore
359
367
from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials
360
368
from azure.ai.ml import MLClient
369
+ from azure.identity import DefaultAzureCredential
361
370
362
- ml_client = MLClient.from_config()
371
+ ml_client = MLClient.from_config(credential = DefaultAzureCredential() )
363
372
364
373
store = AzureDataLakeGen1Datastore(
365
374
name = " adls_gen1_example" ,
@@ -445,8 +454,9 @@ You will then find "Endpoint", "Workspace GUID" and "Artifact GUID" in "URL" and
445
454
``` python
446
455
from azure.ai.ml.entities import OneLakeDatastore, OneLakeArtifact
447
456
from azure.ai.ml import MLClient
457
+ from azure.identity import DefaultAzureCredential
448
458
449
- ml_client = MLClient.from_config()
459
+ ml_client = MLClient.from_config(credential = DefaultAzureCredential() )
450
460
451
461
store = OneLakeDatastore(
452
462
name = " onelake_example_id" ,
@@ -465,16 +475,12 @@ ml_client.create_or_update(store)
465
475
# [ Python SDK: Service principal] ( #tab/sdk-onelake-sp )
466
476
467
477
``` python
468
- from azure.ai.ml.entities import AzureDataLakeGen1Datastore
478
+ from azure.ai.ml.entities import OneLakeDatastore, OneLakeArtifact
469
479
from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials
470
480
from azure.ai.ml import MLClient
481
+ from azure.identity import DefaultAzureCredential
471
482
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())
478
484
479
485
store = OneLakeDatastore(
480
486
name = " onelake_example_sp" ,
0 commit comments