title: How upload file to blob storage and reference it from cosmosdb document in attachment
body: <p>I'm new to CosmosDb and azure blob storage, as a requirement I need to reference a file uploaded to azure blob storage from a document in CosmosDb and use it in the attachment section to save the metadata.</p>
  
  <p>I know the json metadata stucture should be like this: </p>
  
  <pre><code>{    
     "id":"image13d65101-90c4-4c2a-a423-fbf221c73233",  
     "contentType":"image/jpg",  
     "media":"www.bing.com",  
     "_rid":"rnYYAMVFUAUBAAAAAAAAAEC+LNM=",  
     "_ts":1408056025,  
     "_self":"dbs\/rnYYAA==\/colls\/rnYYAMVFUAU=\/docs\/rnYYAMVFUAUBAAAAAAAAAA==\/attachments\/rnYYAMVFUAUBAAAAAAAAAEC+LNM=",  
     "_etag":"00002a00-0000-0000-0000-53ed3ad90000"  
  }
  </code></pre>
  
  <p>but how can I get a reference to the media property when uploading the file to azure blob storage, more accurately how do I upload a file from c# to azure blob storage and reference it by setting the url to the media property.</p>