Forum Discussion

rahul-biswas_le's avatar
rahul-biswas_le
New Member
1 year ago
Solved

ADLS Gen 2 Connection creation using Fabric REST API

I want to create a connection to ADLS Gen 2 using Fabric Rest API. Can anyone please share an example of how to construct the request body for the API call for this scenario? I have managed to get this, but this is erroring out at the Server end.

 

import requests

# Define the API endpoint and bearer token

# Define the request body
request_body = {
    "connectionDetails":
    # Add your connection details here
    {
        "type": "AzureDataLakeStorage",
        "creationMethod": "AzureDataLakeStorage", # What do I give for creationMethod?
        "parameters": [
            {
                "dataType": "Text",
                "name": "server",
                "value": "https://XXXXXXXXX.dfs.core.windows.net",
            },
            {
                "dataType": "Text",
                "name": "fullPath",
                "value": "optraroot"
            }
        ],
    },
    "connectivityType": "ShareableCloud",  # Connectivity type as specified
    "credentialDetails": {
        "connectionEncryption": "NotEncrypted",
        "credentialType": "ServicePrincipal",
        "credentials": {
            "servicePrincipalClientId": "XXXXXXXXX",
            "servicePrincipalSecret": "XXXXXXXXXXXX",
            "tenantId": "XXXXXXXXX",
        },
        "singleSignOnType": "None",
        "skipTestConnection": True,
    },
    'gatewayId': None,
    "displayName": "My Connection",  # Replace with the desired display name (max 200 chars)
    "privacyLevel": "None",  # Replace with the appropriate privacy level
}
 
@Connections - Create Connection - REST API (Core) | Microsoft Learn
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi rahul-biswas_le,

    Thank you for reaching out in Microsoft Community Forum.

    providing the documents which might you assist you in creating a connection to ADLS Gen 2 using Fabric Rest API.
    Azure Data Lake Storage Gen2 REST API reference - Azure Storage | Microsoft Learn
    Set up your Azure Data Lake Storage Gen2 connection - Microsoft Fabric | Microsoft Learn


    Please continue using Microsoft community forum.

    If you found this post helpful, please consider marking it as "Accept as Solution" and select "Yes" if it was helpful. help other members find it more easily.

    Regards,
    Pavan.

  • Here is the sample request body that worked for me with Workspace Identity as authentication. 
    Try changing the auth to SPN in your case. Hope this helps.

     

    {
    	"displayName": "FHE_TestEndPoint",
    	"connectivityType": "ShareableCloud",
    	"connectionDetails": {
    		"creationMethod": "AzureDataLakeStorage",
    		"type": "AzureDataLakeStorage",
    		"parameters": [
    			{
    				"dataType": "Text",
    				"name": "server",
    				"value": "https://sampleadls.dfs.core.windows.net"
    			},
    			{
    				"dataType": "Text",
    				"name": "path",
    				"value": "sampleadlscontainer"
    			}
    		]
    	},
    	"privacyLevel": "Organizational",
    	"credentialDetails": {
    		"credentials": {
    			"credentialType": "WorkspaceIdentity"
    		},
    		"connectionEncryption": "NotEncrypted",
    		"skipTestConnection": false,
    		"singleSignOnType": "None"
    	},
    	"allowDatasourceThroughGateway": false
    }

     

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi rahul-biswas_le,

    Thank you for reaching out in Microsoft Community Forum.

    providing the documents which might you assist you in creating a connection to ADLS Gen 2 using Fabric Rest API.
    Azure Data Lake Storage Gen2 REST API reference - Azure Storage | Microsoft Learn
    Set up your Azure Data Lake Storage Gen2 connection - Microsoft Fabric | Microsoft Learn


    Please continue using Microsoft community forum.

    If you found this post helpful, please consider marking it as "Accept as Solution" and select "Yes" if it was helpful. help other members find it more easily.

    Regards,
    Pavan.

  • KrishnaPaudel's avatar
    KrishnaPaudel
    Microsoft Employee

    Here is the sample request body that worked for me with Workspace Identity as authentication. 
    Try changing the auth to SPN in your case. Hope this helps.

     

    {
    	"displayName": "FHE_TestEndPoint",
    	"connectivityType": "ShareableCloud",
    	"connectionDetails": {
    		"creationMethod": "AzureDataLakeStorage",
    		"type": "AzureDataLakeStorage",
    		"parameters": [
    			{
    				"dataType": "Text",
    				"name": "server",
    				"value": "https://sampleadls.dfs.core.windows.net"
    			},
    			{
    				"dataType": "Text",
    				"name": "path",
    				"value": "sampleadlscontainer"
    			}
    		]
    	},
    	"privacyLevel": "Organizational",
    	"credentialDetails": {
    		"credentials": {
    			"credentialType": "WorkspaceIdentity"
    		},
    		"connectionEncryption": "NotEncrypted",
    		"skipTestConnection": false,
    		"singleSignOnType": "None"
    	},
    	"allowDatasourceThroughGateway": false
    }

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi rahul-biswas_le,

    Thank you  for reaching out in Microsoft Community Forum.

    Thank you KrishnaPaudel  for the helpful response.

    As suggested by Krishnapaudel, I hope this information was helpful. Please let me know if you have any further questions or you'd like to discuss this further. If this answers your question, please "Accept as solution" and give it a 'Kudos' so others can find it easily.

    Please continue using Microsoft community forum.

    Regards,
    Pavan.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi rahul-biswas_le,

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please "Accept  as  Solution" and give a 'Kudos' so other members can easily find it.

    Regards,
    Pavan.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi rahul-biswas_le,

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the community members for the issue worked. If our response addressed, please mark it as "Accept as Solution" and  give 'Kudos' if you found it helpful.

     

    Regards,
    Pavan.