简体   繁体   中英

How to create a file or upload a file to Azure Data Lake Storage Gen2

I have created a Azure Data Lake Storage Gen2 account through azure portal. How can I create a file in that account through c# code. I googled a lot but didn't find any samples.

Update 1:

In order to call REST api, I tried to generate token using below code but getting issue.Could you please post some sample code or correct me if anything goes wrong.

在此处输入图片说明

Issue:

AADSTS90002: Tenant 'token' not found. This may happen if there are no active subscriptions for the tenant. Check with your subscription administrator.

Update 2:

I have used below code aswell to create file but it is throwing error.

在此处输入图片说明

在此处输入图片说明

There is a Rest API to CRUD operations for Azure Data Lage Storage Gen2. You can implement them in your code like any other API call. You may Use HttpClient and read the response etc.

Azure Data Lage Storage Gen2 Rest documentation: https://docs.microsoft.com/en-us/rest/api/storageservices/data-lake-storage-gen2

For now no SDK is supported for ADSL gen2, check the document: Known issues with Azure Data Lake Storage Gen2 .

Blob storage APIs are disabled to prevent feature operability issues that could arise because Blob Storage APIs aren't yet interoperable with Azure Data Lake Gen2 APIs.

However you still could use the ADSL REST API , do the create,delete operation.


Update: For now, in the github there is a unofficial sdk, may be you could have a try. It's implemented with the REST API, here is the github link: AzureDataLakeGen2-SDK .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM