AttributeError: 'DefaultAzureCredential' object has no attribute '_to_datastore_rest_object'

nikola 0 Reputation points
2025-03-19T16:39:27.3633333+00:00

--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[13], line 11 1 blob_datastore = AzureBlobDatastore( 2 name = "blob_example", 3 description = "Datastore pointing to a blob container", (...) 8 ), 9 ) ---> 11 ml_client.create_or_update(blob_datastore) File /anaconda/envs/azureml_py310_sdkv2/lib/python3.10/site-packages/azure/ai/ml/_ml_client.py:1225, in MLClient.create_or_update(self, entity, **kwargs) 1209 def create_or_update( 1210 self, 1211 entity: T, 1212 **kwargs, 1213 ) -> T: 1214 """Creates or updates an Azure ML resource. 1215 1216 :param entity: The resource to create or update. (...) 1222 , ~azure.ai.ml.entities.Environment, ~azure.ai.ml.entities.Component, ~azure.ai.ml.entities.Datastore] 1223 """ -> 1225 return _create_or_update(entity, self._operation_container.all_operations, *kwargs) File /anaconda/envs/azureml_py310_sdkv2/lib/python3.10/functools.py:889, in singledispatch.<locals>.wrapper(args, kw) 885 if not args: 886 raise TypeError(f'{funcname} requires at least ' 887 '1 positional argument') --> 889 return dispatch(args[0].class)(*args, **kw) File /anaconda/envs/azureml_py310_sdkv2/lib/python3.10/site-packages/azure/ai/ml/_ml_client.py:1320, in _(entity, operations) 1317 @_create_or_update.register(Datastore) 1318 def _(entity: Datastore, operations): 1319 module_logger.debug("Creating or updating datastores") -> 1320 return operations[AzureMLResourceType.DATASTORE].create_or_update(entity) File /anaconda/envs/azureml_py310_sdkv2/lib/python3.10/site-packages/azure/ai/ml/_telemetry/activity.py:289, in monitor_with_activity.<locals>.monitor.<locals>.wrapper(*args, **kwargs) 285 with tracer.span(): 286 with log_activity( 287 logger.package_logger, activity_name or f.name, activity_type, custom_dimensions 288 ): --> 289 return f(*args, **kwargs) 290 elif hasattr(logger, "package_logger"): 291 with log_activity(logger.package_logger, activity_name or f.name, activity_type, custom_dimensions): File /anaconda/envs/azureml_py310_sdkv2/lib/python3.10/site-packages/azure/ai/ml/operations/_datastore_operations.py:237, in DatastoreOperations.create_or_update(self, datastore) 235 log_and_raise_error(ex) 236 else: --> 237 raise ex File /anaconda/envs/azureml_py310_sdkv2/lib/python3.10/site-packages/azure/ai/ml/operations/_datastore_operations.py:224, in DatastoreOperations.create_or_update(self, datastore) 207 """Attaches the passed in datastore to the workspace or updates the datastore if it already exists. 208 209 :param datastore: The configuration of the datastore to attach. (...) 221 :caption: Create datastore example. 222 """ 223 try: --> 224 ds_request = datastore._to_rest_object() 225 datastore_resource = self._operation.create_or_update( 226 name=datastore.name, 227 resource_group_name=self._operation_scope.resource_group_name, (...) 230 skip_validation=True, 231 ) 232 return Datastore._from_rest_object(datastore_resource) File /anaconda/envs/azureml_py310_sdkv2/lib/python3.10/site-packages/azure/ai/ml/entities/_datastore/azure_storage.py:187, in AzureBlobDatastore._to_rest_object(self) 183 def _to_rest_object(self) -> DatastoreData: 184 blob_ds = RestAzureBlobDatastore( 185 account_name=self.account_name, 186 container_name=self.container_name, --> 187 credentials=self.credentials._to_datastore_rest_object(), 188 endpoint=self.endpoint, 189 protocol=self.protocol, 190 tags=self.tags, 191 description=self.description, 192 ) 193 return DatastoreData(properties=blob_ds) AttributeError: 'DefaultAzureCredential' object has no attribute '_to_datastore_rest_object'

Getting the above error when trying to create a datastore.

Azure Machine Learning

1 answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    1 deleted comment

    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.