An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
Hi @Lilu Wan
Thank you for the detailed investigation and testing results.
Based on the current Microsoft Spark utilities implementation, mssparkutils.credentials.getToken() supports only a predefined set of audience aliases, and currently Azure Cognitive Services / Azure AI Foundry audiences are not included. This explains why requests such as:
mssparkutils.credentials.getToken("https://cognitiveservices.azure.com")
or aliases like:
mssparkutils.credentials.getToken("CognitiveServices")
are failing.
At present, the recommended workaround is to use the Azure Identity SDK directly inside the Synapse Spark notebook with the workspace Managed Identity, for example:
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
token = credential.get_token(
"https://cognitiveservices.azure.com/.default"
)
print(token.token)
This approach allows token acquisition using the workspace System Assigned Managed Identity without relying on certificate-based authentication.
Similarly, for Azure AI Foundry scenarios, the corresponding scope can be requested using:
"https://ai.azure.com/.default"
Your feedback regarding additional aliases such as:
CognitiveServices
AIServices
is valid and would improve managed identity integration experience within Synapse Spark. We recommend submitting this through official feedback/support channels so the Product Group can evaluate adding support in the Synapse Token Service.
Thank you for highlighting this scenario and sharing the detailed validation results.