@@ -36,8 +36,9 @@ In this article, you learn how to connect to Azure data storage services with Az
3636``` python
3737from azure.ai.ml.entities import AzureBlobDatastore
3838from 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
4243store = AzureBlobDatastore(
4344 name = " " ,
@@ -55,8 +56,9 @@ ml_client.create_or_update(store)
5556from azure.ai.ml.entities import AzureBlobDatastore
5657from azure.ai.ml.entities import AccountKeyConfiguration
5758from 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
6163store = AzureBlobDatastore(
6264 name = " blob_protocol_example" ,
@@ -78,8 +80,9 @@ ml_client.create_or_update(store)
7880from azure.ai.ml.entities import AzureBlobDatastore
7981from azure.ai.ml.entities import SasTokenConfiguration
8082from 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
8487store = AzureBlobDatastore(
8588 name = " blob_sas_example" ,
@@ -163,8 +166,9 @@ az ml datastore create --file my_blob_datastore.yml
163166``` python
164167from azure.ai.ml.entities import AzureDataLakeGen2Datastore
165168from 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
169173store = AzureDataLakeGen2Datastore(
170174 name = " " ,
@@ -183,8 +187,9 @@ from azure.ai.ml.entities import AzureDataLakeGen2Datastore
183187from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials
184188
185189from 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
189194store = AzureDataLakeGen2Datastore(
190195 name = " adls_gen2_example" ,
@@ -252,8 +257,9 @@ az ml datastore create --file my_adls_datastore.yml
252257from azure.ai.ml.entities import AzureFileDatastore
253258from azure.ai.ml.entities import AccountKeyConfiguration
254259from 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
258264store = AzureFileDatastore(
259265 name = " file_example" ,
@@ -274,8 +280,9 @@ ml_client.create_or_update(store)
274280from azure.ai.ml.entities import AzureFileDatastore
275281from azure.ai.ml.entities import SasTokenConfiguration
276282from 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
280287store = AzureFileDatastore(
281288 name = " file_sas_example" ,
@@ -340,8 +347,9 @@ az ml datastore create --file my_files_datastore.yml
340347``` python
341348from azure.ai.ml.entities import AzureDataLakeGen1Datastore
342349from 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
346354store = AzureDataLakeGen1Datastore(
347355 name = " " ,
@@ -358,8 +366,9 @@ ml_client.create_or_update(store)
358366from azure.ai.ml.entities import AzureDataLakeGen1Datastore
359367from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials
360368from 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
364373store = 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
446455from azure.ai.ml.entities import OneLakeDatastore, OneLakeArtifact
447456from 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
451461store = 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
469479from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials
470480from 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
479485store = OneLakeDatastore(
480486 name = " onelake_example_sp" ,
0 commit comments