Using Data Access Service (DAS) to access ADLS and ABS compatible storages
External applications and query engines can access the Azure Data Lake Storage (ADLS) and Azure Blob Storage (ABS) compatible storages that are managed by watsonx.data through DAS proxy.
DAS proxy support for ADLS and ABS works only with AccountKey to pass watsonx.data credential. Using SASToken to pass watsonx.data credential is not supported.
To access the ADLS and ABS compatible storages:
-
Get the DAS endpoint from the watsonx.data information window. Click the
i
icon on the home page to open the information window. -
Replace the ADLS or ABS endpoint with the DAS endpoint in your Java code. Replace the access name with the encoded value as follows:
base64{<crn>|Basic base64{ibmlhapikey_<user_id>:<IAM_APIKEY>}}
To get the Base64 encoded string, use one of the following commands:
printf "username:<apikey>" | base64
echo -n "username:<apikey>" | base64
-
Replace the container name in the Java code as follows:
cas/v1/proxy/<storage name in watsonx.data>
Java code example to use DAS
//For IBM Cloud <ADLS or ABS account name>|base64{<crn>|Basic base64{ibmlhapikey_<user_id>:<IAM_APIKEY>}}
//For AWS <ADLS or ABS account name>|base64{<crn>|Basic base64{ibmlhapikey_ServiceId-<service_id>:<APIKEY>}}
String accountName = "<ADLS or ABS account name>|base64{<instanceid>|ZenApikey base64{username:<apikey>}}";
String accountKey = "any string";
String endPoint = "<DAS endpoint>";
String containerName ="cas/v1/proxy/<storagename in watsonx.data>";
String endpoint = String.format(endPoint,accountName);
BlobServiceClient blobServiceClient = new BlobServiceClientBuilder()
.endpoint(endpoint)
.credential(new StorageSharedKeyCredential(accountName, accountKey))
.buildClient();
BlobContainerClient containerClient = blobServiceClient.getBlobContainerClient(containerName);