How to connect to ADLS using Polybase via Service Principal

Priya Jha 901 Reputation points
2020-12-24T13:26:03.537+00:00

Hi All,

I tried connecting to ADLS via polybase and performed below steps:

A) Connecting via Access Key

I have created a database scoped credential with Access key of ADLS as shown below:

create DATABASE SCOPED CREDENTIAL [AEAPADLSStorageCred] WITH IDENTITY = 'dp201',
SECRET = '<Access Key>'

Then created Data Source with the following format:

CREATE EXTERNAL DATA SOURCE [AEAPADLSStorage] WITH
(
TYPE = HADOOP,
LOCATION = 'wasbs://******@adlsname.blob.core.windows.net',
CREDENTIAL = [AEAPADLSStorageCred]
)

After that created External file format and external table and csv file was read successfully.

B) Connecting via Service Principal

I have created a Service Principal and have provided it access on my ADLS

Then created Database scoped credential with following format:

51134-adlssp.png

Then created data source with the following format:

CREATE EXTERNAL DATA SOURCE [AEAPADLSStorageSP] WITH
(
TYPE = HADOOP,
LOCATION = 'wasbs://******@adlsname.blob.core.windows.net',
CREDENTIAL = ADL_User
)

But getting the following error when creating external table: unable to connect to blob with provided creds

I tried altering data source with following format:

alter EXTERNAL DATA SOURCE [AEAPADLSStorageSP] set
LOCATION = 'abfss://******@dp201adls.dfs.core.windows.net',
CREDENTIAL = ADL_User

But getting the same error when creating the external table

What is the correct syntax to create database scoped credential and data source to connect to ADLS via Service Principal?

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
{count} votes

1 answer

Sort by: Most helpful
  1. HarithaMaddi-MSFT 10,151 Reputation points
    2021-01-07T15:59:38.377+00:00

    Hi @Priya Jha ,

    Thanks for sharing your valuable feedback. Product team looked into it and suggested correct syntax and would be soon publishing the correct changes to the document as well. In the OAuth 2.0 endpoint please replace "organizations" with Tenant ID and please remove "\" after @ in the identity as below which is working fine to retrieve the data from ADLS.

    54473-image.png

    Please let us know for further queries and we will be glad to assist.

    --

    • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification.

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.