@@ -124,19 +124,20 @@ ml_client.create_or_update(store)
124
124
125
125
``` python
126
126
from azure.ai.ml.entities import AzureBlobDatastore
127
+ from azure.ai.ml.entities._datastore.credentials import AccountKeyCredentials
127
128
from azure.ai.ml import MLClient
128
129
129
130
ml_client = MLClient.from_config()
130
131
131
132
store = AzureBlobDatastore(
132
- name = " blob-protocol-example " ,
133
+ name = " blob_protocol_example " ,
133
134
description = " Datastore pointing to a blob container using wasbs protocol." ,
134
135
account_name = " mytestblobstore" ,
135
136
container_name = " data-container" ,
136
137
protocol = " wasbs" ,
137
- credentials = {
138
- " account_key" : " XXXxxxXXXxXXXXxxXXXXXxXXXXXxXxxXxXXXxXXXxXXxxxXXxxXXXxXxXXXxxXxxXXXXxxxxxXXxxxxxxXXXxXXX"
139
- } ,
138
+ credentials = AccountKeyCredentials(
139
+ account_key = " XXXxxxXXXxXXXXxxXXXXXxXXXXXxXxxXxXXXxXXXxXXxxxXXxxXXXxXxXXXxxXxxXXXXxxxxxXXxxxxxxXXXxXXX"
140
+ ) ,
140
141
)
141
142
142
143
ml_client.create_or_update(store)
@@ -146,18 +147,19 @@ ml_client.create_or_update(store)
146
147
147
148
``` python
148
149
from azure.ai.ml.entities import AzureBlobDatastore
150
+ from azure.ai.ml.entities._datastore.credentials import SasTokenCredentials
149
151
from azure.ai.ml import MLClient
150
152
151
153
ml_client = MLClient.from_config()
152
154
153
155
store = AzureBlobDatastore(
154
- name = " blob-sas-example " ,
156
+ name = " blob_sas_example " ,
155
157
description = " Datastore pointing to a blob container using SAS token." ,
156
158
account_name = " mytestblobstore" ,
157
159
container_name = " data-container" ,
158
- credentials = {
159
- " sas_token" : " ?xx=XXXX-XX-XX&xx=xxxx&xxx=xxx&xx=xxxxxxxxxxx&xx=XXXX-XX-XXXXX:XX:XXX&xx=XXXX-XX-XXXXX:XX:XXX&xxx=xxxxx&xxx=XXxXXXxxxxxXXXXXXXxXxxxXXXXXxxXXXXXxXXXXxXXXxXXxXX"
160
- } ,
160
+ credentials = SasTokenCredentials(
161
+ sas_token = " ?xx=XXXX-XX-XX&xx=xxxx&xxx=xxx&xx=xxxxxxxxxxx&xx=XXXX-XX-XXXXX:XX:XXX&xx=XXXX-XX-XXXXX:XX:XXX&xxx=xxxxx&xxx=XXxXXXxxxxxXXXXXXXxXxxxXXXXXxxXXXXXxXXXXxXXXxXXxXX"
162
+ ) ,
161
163
)
162
164
163
165
ml_client.create_or_update(store)
@@ -230,20 +232,22 @@ ml_client.create_or_update(store)
230
232
231
233
``` python
232
234
from azure.ai.ml.entities import AzureDataLakeGen2Datastore
235
+ from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials
236
+
233
237
from azure.ai.ml import MLClient
234
238
235
239
ml_client = MLClient.from_config()
236
240
237
241
store = AzureDataLakeGen2Datastore(
238
- name = " adls-gen2-example " ,
242
+ name = " adls_gen2_example " ,
239
243
description = " Datastore pointing to an Azure Data Lake Storage Gen2." ,
240
244
account_name = " mytestdatalakegen2" ,
241
245
filesystem = " my-gen2-container" ,
242
- credentials = {
243
- " tenant_id" : " XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ,
244
- " client_id" : " XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ,
245
- " client_secret" : " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ,
246
- } ,
246
+ credentials = ServicePrincipalCredentials(
247
+ tenant_id = " XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ,
248
+ client_id = " XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ,
249
+ client_secret = " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ,
250
+ ) ,
247
251
)
248
252
249
253
ml_client.create_or_update(store)
@@ -298,18 +302,19 @@ az ml datastore create --file my_files_datastore.yml
298
302
299
303
``` python
300
304
from azure.ai.ml.entities import AzureFileDatastore
305
+ from azure.ai.ml.entities._datastore.credentials import AccountKeyCredentials
301
306
from azure.ai.ml import MLClient
302
307
303
308
ml_client = MLClient.from_config()
304
309
305
310
store = AzureFileDatastore(
306
- name = " file-example " ,
311
+ name = " file_example " ,
307
312
description = " Datastore pointing to an Azure File Share." ,
308
313
account_name = " mytestfilestore" ,
309
314
file_share_name = " my-share" ,
310
- credentials = {
311
- " account_key" : " XXXxxxXXXxXXXXxxXXXXXxXXXXXxXxxXxXXXxXXXxXXxxxXXxxXXXxXxXXXxxXxxXXXXxxxxxXXxxxxxxXXXxXXX"
312
- } ,
315
+ credentials = AccountKeyCredentials(
316
+ account_key = " XXXxxxXXXxXXXXxxXXXXXxXXXXXxXxxXxXXXxXXXxXXxxxXXxxXXXxXxXXXxxXxxXXXXxxxxxXXxxxxxxXXXxXXX"
317
+ ) ,
313
318
)
314
319
315
320
ml_client.create_or_update(store)
@@ -319,18 +324,19 @@ ml_client.create_or_update(store)
319
324
320
325
``` python
321
326
from azure.ai.ml.entities import AzureFileDatastore
327
+ from azure.ai.ml.entities._datastore.credentials import SasTokenCredentials
322
328
from azure.ai.ml import MLClient
323
329
324
330
ml_client = MLClient.from_config()
325
331
326
332
store = AzureFileDatastore(
327
- name = " file-sas-example " ,
333
+ name = " file_sas_example " ,
328
334
description = " Datastore pointing to an Azure File Share using SAS token." ,
329
335
account_name = " mytestfilestore" ,
330
336
file_share_name = " my-share" ,
331
- credentials = {
332
- " sas_token" : " ?xx=XXXX-XX-XX&xx=xxxx&xxx=xxx&xx=xxxxxxxxxxx&xx=XXXX-XX-XXXXX:XX:XXX&xx=XXXX-XX-XXXXX:XX:XXX&xxx=xxxxx&xxx=XXxXXXxxxxxXXXXXXXxXxxxXXXXXxxXXXXXxXXXXxXXXxXXxXX"
333
- } ,
337
+ credentials = SasTokenCredentials(
338
+ sas_token = " ?xx=XXXX-XX-XX&xx=xxxx&xxx=xxx&xx=xxxxxxxxxxx&xx=XXXX-XX-XXXXX:XX:XXX&xx=XXXX-XX-XXXXX:XX:XXX&xxx=xxxxx&xxx=XXxXXXxxxxxXXXXXXXxXxxxXXXXXxxXXXXXxXXXXxXXXxXXxXX"
339
+ ) ,
334
340
)
335
341
336
342
ml_client.create_or_update(store)
@@ -400,19 +406,20 @@ ml_client.create_or_update(store)
400
406
401
407
``` python
402
408
from azure.ai.ml.entities import AzureDataLakeGen1Datastore
409
+ from azure.ai.ml.entities._datastore.credentials import ServicePrincipalCredentials
403
410
from azure.ai.ml import MLClient
404
411
405
412
ml_client = MLClient.from_config()
406
413
407
414
store = AzureDataLakeGen1Datastore(
408
- name = " adls-gen1-example " ,
415
+ name = " adls_gen1_example " ,
409
416
description = " Datastore pointing to an Azure Data Lake Storage Gen1." ,
410
417
store_name = " mytestdatalakegen1" ,
411
- credentials = {
412
- " tenant_id" : " XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ,
413
- " client_id" : " XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ,
414
- " client_secret" : " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ,
415
- } ,
418
+ credentials = ServicePrincipalCredentials(
419
+ tenant_id = " XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ,
420
+ client_id = " XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" ,
421
+ client_secret = " XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ,
422
+ ) ,
416
423
)
417
424
418
425
ml_client.create_or_update(store)
0 commit comments