Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
rahul-biswas_le
New Member

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
2 ACCEPTED SOLUTIONS
v-pbandela-msft
Community Support
Community Support

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.

View solution in original post

KrishnaPaudel
Microsoft Employee
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
}

 

View solution in original post

5 REPLIES 5
v-pbandela-msft
Community Support
Community Support

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.

v-pbandela-msft
Community Support
Community Support

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.

v-pbandela-msft
Community Support
Community Support

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.

KrishnaPaudel
Microsoft Employee
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
}

 

v-pbandela-msft
Community Support
Community Support

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.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.