Reading/writing data in one azure gen2 storage account in multiple paths using multiple linked services in synapse notebook. we can't read with single linked service as we have multiple SPN which has the access to all the paths.
Steps I followed to implement the same
1. Created a multiple linked service pointing to the gen2 storages using varies SPN1 , SPN2
linked_service_name = 'ln_spn1_path_1'
spark.conf.set('spark.storage.synapse.linkedServiceName',linked_service_name)
spark.conf.set('fs.azure.account.oauth.provider.type','com.microsoft.azure.synapse.tokenlibrary.LinkedServiceBasedTokenProvider')
Created linked service ln_spn2_path_2 using spn 2 and pointing to the path2
**linked_service_name = 'ln_spn2_path_2' spark.conf.set('spark.storage.synapse.linkedServiceName',linked_service_name) spark.conf.set('fs.azure.account.oauth.provider.type','com.microsoft.azure.synapse.tokenlibrary.LinkedServiceBasedTokenProvider')
mssparkutils.fs.ls("abfss://container@storaegaccount.dfs.core.windows.net/path2")**
If above both the commonds run in same synapse notebook so we will get the below error which ever we run later
Py4JJavaError: An error occurred while calling z:mssparkutils.fs.ls. : java.nio.file.AccessDeniedException: Operation failed: "This request is not authorized to perform this operation using this permission.", 403, GET, AuthorizationPermissionMismatch, "This request is not authorized to perform this operation using this permission. RequestId:8853fd20-001f-0018-0347-bf3712000000 Time:2021-10-12T08:57:13.0513182Z"
Can we read the data using to different linked services in same notebook?



