This article is contributed. See the original author and article here.


Following this lab: Lab: Serverless Synapse – From Spark to SQL On Demand – Microsoft Tech Community

You may experience this message: 

Failed to execute the query because content of directory cannot be listed) 

This is due to an extra step required to enable the AAD to pass through the firewall on the storage.



Query SQL Serverless failed as following while querying Spark. 



On Azure Portal, Storage Account -> Networking is configured as follows ( with Allow trusted Microsoft services to access this account enabled):


If you change to All Networks it does work successfully. 


Mitigation: Enable the AAD to pass through the firewall on the storage.


Run the following-> exactly like this example but replace the values as required: 




Add-AzStorageAccountNetworkRule -ResourceGroupName $resourceGroupName -Name $accountName -TenantId $tenantId -ResourceId "/subscriptions/<subscriptionid>/resourcegroups/<rgname>/providers/Microsoft.Synapse/workspaces/<workspacename>"



For the Tenant ID you can get the value from the Azure Portal ->AAD



Microsoft DocControl storage account access for serverless SQL pool – Azure Synapse Analytics | Microsoft Docs


Note you may need to install Power Shell version 3 like my example:

(PowerShell Gallery | Az.Storage 3.0.1-preview)



Thanks to Stefan Azaric.


That is it!


UK Engineer.

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.

%d bloggers like this: