-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
what
When using download_artifact_from_aml_uri() with a datastore configured for identity-based access (no stored credentials), the SDK internally raises an HttpResponseError that gets caught and handled correctly, but the exception is still captured by OpenTelemetry tracing. This causes noisy error traces in Application Insights even though the operation succeeds.
To Reproduce
Configure an Azure ML datastore with identity-based access (no account key or SAS token stored)
Enable OpenTelemetry tracing (e.g., via azure-monitor-opentelemetry)
Download an artifact using download_artifact_from_aml_uri()
from azure.ai.ml import MLClient
import azure.ai.ml._artifacts._artifact_utilities as artifact_utils
ml_client = MLClient(DefaultAzureCredential(), subscription_id, resource_group, workspace)
artifact_utils.download_artifact_from_aml_uri(
uri="azureml://subscriptions/.../datastores/mystore/paths/data.csv",
destination="/tmp/output",
datastore_operation=ml_client.datastores
)Expected behavior
The download succeeds (which it does), but no exception should appear in traces since this is expected behavior for identity-based datastores.
Actual behavior
The download succeeds, but an exception trace is recorded:
azure.core.exceptions.HttpResponseError: (UserError) No secrets for credentials of type None.
Code: UserError
Message: No secrets for credentials of type None.
Root cause
In _artifact_utilities.py, get_datastore_info() uses a try/except pattern:
try:
credential = operations._list_secrets(name=name, expirable_secret=True)
datastore_info["credential"] = credential.sas_token
except HttpResponseError:
datastore_info["credential"] = operations._credentialMaybe consider one of:
- Check
datastore.credentialstype before calling_list_secrets()to avoid the exception entirely - Return an empty/null credential from
_list_secrets()instead of raising for identity-based datastores
Environment
azure-ai-ml version: 1.30.0
Python version: 3.12
OS: Linux (Azure Container Apps)
Tracing: azure-monitor-opentelemetry