Skip to content

Commit 8a64491

Browse files
authored
Update Credential and Protocol for Blob datastore
The SasTokenCredential and the AccountKeyCredential are no longer used and have been replaced by SasTokenConfiguration and AccountKeyConfiguration. In addition, wasbs does not appear to be a support protocol and should instead be https * https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.entities.sastokenconfiguration?view=azure-python * https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.entities.accountkeyconfiguration?view=azure-python * https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.entities.azureblobdatastore?view=azure-python - This doc doesn't explicitly state that it must be https but when trying to run this on Azure ML Notebooks with the 3.10 SDK v2 kernel, only https would work. I believe the reference to ServicePrincipalCredential is also out of date and should be replaced with ServicePrincipalConfiguration but I have not tested that. * https://learn.microsoft.com/en-us/python/api/azure-ai-ml/azure.ai.ml.entities.serviceprincipalconfiguration?view=azure-python
1 parent cdceb3e commit 8a64491

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,18 @@ ml_client.create_or_update(store)
123123

124124
```python
125125
from azure.ai.ml.entities import AzureBlobDatastore
126-
from azure.ai.ml.entities._datastore.credentials import AccountKeyCredentials
126+
from azure.ai.ml.entities import AccountKeyConfiguration
127127
from azure.ai.ml import MLClient
128128

129129
ml_client = MLClient.from_config()
130130

131131
store = AzureBlobDatastore(
132132
name="blob_protocol_example",
133-
description="Datastore pointing to a blob container using wasbs protocol.",
133+
description="Datastore pointing to a blob container using https protocol.",
134134
account_name="mytestblobstore",
135135
container_name="data-container",
136-
protocol="wasbs",
137-
credentials=AccountKeyCredentials(
136+
protocol="https",
137+
credentials=AccountKeyConfiguration(
138138
account_key="XXXxxxXXXxXXXXxxXXXXXxXXXXXxXxxXxXXXxXXXxXXxxxXXxxXXXxXxXXXxxXxxXXXXxxxxxXXxxxxxxXXXxXXX"
139139
),
140140
)
@@ -146,7 +146,7 @@ ml_client.create_or_update(store)
146146

147147
```python
148148
from azure.ai.ml.entities import AzureBlobDatastore
149-
from azure.ai.ml.entities._datastore.credentials import SasTokenCredentials
149+
from azure.ai.ml.entities import SasTokenConfiguration
150150
from azure.ai.ml import MLClient
151151

152152
ml_client = MLClient.from_config()
@@ -156,7 +156,7 @@ store = AzureBlobDatastore(
156156
description="Datastore pointing to a blob container using SAS token.",
157157
account_name="mytestblobstore",
158158
container_name="data-container",
159-
credentials=SasTokenCredentials(
159+
credentials=SasTokenConfiguration(
160160
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"
161161
),
162162
)
@@ -301,7 +301,7 @@ az ml datastore create --file my_files_datastore.yml
301301

302302
```python
303303
from azure.ai.ml.entities import AzureFileDatastore
304-
from azure.ai.ml.entities._datastore.credentials import AccountKeyCredentials
304+
from azure.ai.ml.entities import AccountKeyConfiguration
305305
from azure.ai.ml import MLClient
306306

307307
ml_client = MLClient.from_config()
@@ -311,7 +311,7 @@ store = AzureFileDatastore(
311311
description="Datastore pointing to an Azure File Share.",
312312
account_name="mytestfilestore",
313313
file_share_name="my-share",
314-
credentials=AccountKeyCredentials(
314+
credentials=AccountKeyConfiguration(
315315
account_key= "XXXxxxXXXxXXXXxxXXXXXxXXXXXxXxxXxXXXxXXXxXXxxxXXxxXXXxXxXXXxxXxxXXXXxxxxxXXxxxxxxXXXxXXX"
316316
),
317317
)
@@ -323,7 +323,7 @@ ml_client.create_or_update(store)
323323

324324
```python
325325
from azure.ai.ml.entities import AzureFileDatastore
326-
from azure.ai.ml.entities._datastore.credentials import SasTokenCredentials
326+
from azure.ai.ml.entities import SasTokenConfiguration
327327
from azure.ai.ml import MLClient
328328

329329
ml_client = MLClient.from_config()
@@ -333,7 +333,7 @@ store = AzureFileDatastore(
333333
description="Datastore pointing to an Azure File Share using SAS token.",
334334
account_name="mytestfilestore",
335335
file_share_name="my-share",
336-
credentials=SasTokenCredentials(
336+
credentials=SasTokenConfiguration(
337337
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"
338338
),
339339
)

0 commit comments

Comments
 (0)