Home
%3CLINGO-SUB%20id%3D%22lingo-sub-862260%22%20slang%3D%22en-US%22%3EHow%20to%20use%20PolyBase%20by%20authenticating%20via%20AAD%20pass-through%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-862260%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20blog%20highlights%20how%20to%20load%20and%20query%20using%20PolyBase%20by%20authenticating%20via%20Azure%20Active%20Directory%20(AAD)%20pass-through%20to%20Azure%20Data%20Lake%20Storage%20Gen2.%20AAD%20pass-through%20authentication%20with%20PolyBase%20is%20much%20more%20secure%20and%20compliant%20where%20you%20no%20longer%20need%20CONTROL%20permissions%20on%20the%20data%20warehouse%20to%20initiate%20a%20load.%20You%20can%20now%20securely%20and%20immediately%20achieve%20high%20throughput%20data%20ingestion%20with%20only%20a%20few%20steps%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ENavigate%20to%20your%20Azure%20Data%20Lake%20Storage%20(ADLS)%20Gen2%20account%20in%20the%20portal%20and%20grant%20load%20access%20to%20the%20AAD%20User%20or%20Group%20by%20assigning%20the%20Storage%20Blob%20Data%20Reader%2C%20Contributor%2C%20or%20Owner%20Role%20to%20the%20ADLS%20Gen2%20account%3A%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F132483i6B0B7875BEA1681A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22clipboard_image_1.png%22%20title%3D%22clipboard_image_1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EConnect%20to%20your%20data%20warehouse%20through%20the%20same%20AAD%20User%20or%20Group%20with%20load%20access%20to%20the%20ADLS%20Gen2%20account%20and%20to%20create%20the%20following%20objects%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%20style%3D%22text-align%3A%20left%3B%22%3ECreate%20an%20external%20file%20format%20-%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3ECREATE%20EXTERNAL%20FILE%20FORMAT%20CustomerFileFormat%0AWITH%20(%0A%20%20%20%20FORMAT_TYPE%20%3D%20DelimitedText%2C%0A%20%20%20%20FORMAT_OPTIONS%20(FIELD_TERMINATOR%20%3D%20'%2C')%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENote%3A%20Requires%20ALTER%20ANY%20EXTERNAL%20FILE%20FORMAT%20permission%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECreate%20an%20external%20data%20source%20-%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3ECREATE%20EXTERNAL%20DATA%20SOURCE%20AADPassthrough_storage%0AWITH%20(%0A%20TYPE%3Dhadoop%2C%0A%20LOCATION%3D'abfss%3A%2F%2Faadpassthrough%40sample.dfs.core.windows.net'%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENote%3A%20Requires%20ALTER%20ANY%20EXTERNAL%20DATA%20SOURCE%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECreate%20an%20external%20table%20for%20the%20load%20-%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3ECREATE%20EXTERNAL%20TABLE%20%5Bdbo%5D.%5Bcustomer_ext%5D%0A(%0A%20%20%20%20%20%20%20NAME%20%20%20varchar(20)%20not%20null%2C%0A%20%20%20%20%20%20%20AGE%20%20int%0A)%0AWITH%20(%0A%20%20%20%20%20%20%20LOCATION%3D'%2Fcustomer%2F'%2C%0A%20%20%20%20%20%20%20DATA_SOURCE%20%3D%20AADPassthrough_storage%2C%0A%20%20%20%20%20%20%20FILE_FORMAT%20%3D%20CustomerFileFormat%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENote%3A%20Requires%20CREATE%20TABLE%2C%20ALTER%20ANY%20SCHEMA%2C%20ALTER%20ANY%20EXTERNAL%20DATA%20SOURCE%2C%20and%20ALTER%20ANY%20EXTERNAL%20FILE%20FORMAT.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENo%20database%20scoped%20credential%20was%20required%20to%20to%20set%20up%20customer_ext%20external%20table%20where%20you%20can%20now%20load%20and%20query%20from%20your%20ADLS%20Gen2%20storage%20account.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-862260%22%20slang%3D%22en-US%22%3E%3CP%3EAAD%20pass-through%20with%20PolyBase%20is%20now%20available!%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-862260%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ELoad%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPolyBase%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESecurity%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESQL%20Data%20Warehouse%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Esql%20dw%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1037957%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20use%20PolyBase%20by%20authenticating%20via%20AAD%20pass-through%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1037957%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Kevin%2C%20I%20tried%20using%20this%20process%2C%20but%20unfortunatly%20I%20cannot%20get%20it%20to%20work.%3C%2FP%3E%3CP%3EThe%20AAD%20user%20is%20owner%20of%20the%20datalake%20and%20sysadmin%20on%20the%20DW%2C%20so%20it%20should%20not%20be%20a%20rights%20issue%20-%20but%20I%20get%20this%20error%20when%20attempting%20to%20create%20the%20external%20table%3A%3C%2FP%3E%3CP%3EHdfsBridge%3A%3AisDirExist%20-%20Unexpected%20error%20encountered%20checking%20whether%20directory%20exists%20or%20not%3A%26nbsp%3BAbfsRestOperationException%3A%20HEAD%20https%3A%2F%2F%3CREDACTED%3Edfs.core.windows.net%2Ftransformed%2F%3CREDACTED%3E%2F2019%3Ftimeout%3D90%3CBR%20%2F%3EStatusCode%3D403%3CBR%20%2F%3EStatusDescription%3DThis%20request%20is%20not%20authorized%20to%20perform%20this%20operation%20using%20this%20permission.%3CBR%20%2F%3EErrorCode%3D%3CBR%20%2F%3EErrorMessage%3D'%3C%2FREDACTED%3E%3C%2FREDACTED%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1070618%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20use%20PolyBase%20by%20authenticating%20via%20AAD%20pass-through%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1070618%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Ola%2C%20can%20you%20confirm%20what%20kind%20of%20%22owner%22%3F%20It%20should%20be%26nbsp%3B%3CSPAN%3E%3CSTRONG%3EStorage%20Blob%3C%2FSTRONG%3E%20Data%26nbsp%3Bowner.%20If%20you%20are%20still%20running%20into%20issues%2C%20please%20submit%20a%20support%20request%20and%20we%20will%20take%20a%20look.%20Thanks!%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

This blog highlights how to load and query using PolyBase by authenticating via Azure Active Directory (AAD) pass-through to Azure Data Lake Storage Gen2. AAD pass-through authentication with PolyBase is much more secure and compliant where you no longer need CONTROL permissions on the data warehouse to initiate a load. You can now securely and immediately achieve high throughput data ingestion with only a few steps:

 

  1. Navigate to your Azure Data Lake Storage (ADLS) Gen2 account in the portal and grant load access to the AAD User or Group by assigning the Storage Blob Data Reader, Contributor, or Owner Role to the ADLS Gen2 account:clipboard_image_1.png
  2. Connect to your data warehouse through the same AAD User or Group with load access to the ADLS Gen2 account and to create the following objects:

Create an external file format -

 

 

CREATE EXTERNAL FILE FORMAT CustomerFileFormat
WITH (
    FORMAT_TYPE = DelimitedText,
    FORMAT_OPTIONS (FIELD_TERMINATOR = ',')
);

 

 

 

 

 

Note: Requires ALTER ANY EXTERNAL FILE FORMAT permission

 

Create an external data source -

 

 

CREATE EXTERNAL DATA SOURCE AADPassthrough_storage
WITH (
 TYPE=hadoop,
 LOCATION='abfss://aadpassthrough@sample.dfs.core.windows.net'
);

 

 

Note: Requires ALTER ANY EXTERNAL DATA SOURCE

 

Create an external table for the load -

 

 

CREATE EXTERNAL TABLE [dbo].[customer_ext]
(
       NAME   varchar(20) not null,
       AGE  int
)
WITH (
       LOCATION='/customer/',
       DATA_SOURCE = AADPassthrough_storage,
       FILE_FORMAT = CustomerFileFormat
);

 

 

 

Note: Requires CREATE TABLE, ALTER ANY SCHEMA, ALTER ANY EXTERNAL DATA SOURCE, and ALTER ANY EXTERNAL FILE FORMAT.

 

No database scoped credential was required to to set up customer_ext external table where you can now load and query from your ADLS Gen2 storage account.

 

2 Comments
Visitor

Hi Kevin, I tried using this process, but unfortunatly I cannot get it to work.

The AAD user is owner of the datalake and sysadmin on the DW, so it should not be a rights issue - but I get this error when attempting to create the external table:

HdfsBridge::isDirExist - Unexpected error encountered checking whether directory exists or not: AbfsRestOperationException: HEAD https://<redacted>dfs.core.windows.net/transformed/<redacted>/2019?timeout=90
StatusCode=403
StatusDescription=This request is not authorized to perform this operation using this permission.
ErrorCode=
ErrorMessage='

Microsoft

Hi Ola, can you confirm what kind of "owner"? It should be Storage Blob Data owner. If you are still running into issues, please submit a support request and we will take a look. Thanks!