title: How to create a file or upload a file to Azure Data Lake Storage Gen2
body: <p>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.</p>
  
  <p><strong>Update 1:</strong></p>
  
  <p>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.</p>
  
  <p><a href="https://i.stack.imgur.com/EBlsM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EBlsM.png" alt="enter image description here"></a></p>
  
  <p>Issue:</p>
  
  <blockquote>
    <p>AADSTS90002: Tenant 'token' not found. This may happen if there are no
    active subscriptions for the tenant. Check with your subscription
    administrator.</p>
  </blockquote>
  
  <p><strong>Update 2:</strong></p>
  
  <p>I have used below code aswell to create file but it is throwing error.</p>
  
  <p><a href="https://i.stack.imgur.com/MkkVl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MkkVl.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/bv5fv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bv5fv.png" alt="enter image description here"></a></p>