I am trying to mount a folder in one drive business in databricks community edition. I am unable to use onedrivesdk because it is deprecated.
I created a app registration, assigned read and write permissions to that and using the client id and secret.i tried to mount using api requests but it was not giving the access token. First of all i want to know , whether it is possible to mount one drive to databricks community edition. if yes, what are the ways..? Below is the code i used to mount one drive using api requests.
# Import the necessary libraries
import requests
# Set up the client
client_id = ""
client_secret = ""
tenant_id = ""
redirect_uri = "http://localhost:8080/"
# Get the access token
response = requests.post(
"https://login.microsoftonline.com/{}/oauth2/token".format(tenant_id),
data={
"client_id": client_id,
"client_secret": client_secret,
"redirect_uri": redirect_uri,
"grant_type": "client_credentials",
"resource": "https://graph.microsoft.com"
}
)
access_token = response.json()["access_token"]
# Mount the OneDrive folder to DBFS
folder_id = ""
mount_point = "/mnt/onedrive"
dbutils.fs.mount(
source="graph",
mount_point=mount_point,
extra_configs={
"graph.access_token": access_token,
"graph.folder_id": folder_id
}
)