title: Using SAS token to upload Blob content
body: <p>I'm having difficulty in using a Blob SAS token to write a file to a Blob in Azure via Powershell.</p>
  
  <p>The code I'm using to generate the SAS token is:</p>
  
  <pre><code>$storageContext = Get-AzureRmStorageAccount -ResourceGroupName $resourceGroup -Name $storageName
  
  $token = New-AzureStorageBlobSASToken -Container $conName -Context $storageContext.Context -Blob $blobName -ExpiryTime $expiry -Permission rw -FullUri
  </code></pre>
  
  <p>This generates a token as expected: <code>https://name.blob.core.windows.net/container/test.json?sv=2015-04-05&amp;sr=b&amp;sig=abc123&amp;se=2017-03-07T12%3A58%3A52Z&amp;sp=rw</code></p>
  
  <p>If I use this in the browser it's working fine and downloading the file as expected. However, I can't use this to upload a file. Whenever I try I'm receiving a (403) Forbidden. The code I'm using to upload is:</p>
  
  <pre><code>$accountContext = New-AzureStorageContext -SasToken $sasToken
  
  Get-AzureStorageContainer -Context $accountContext.Context | Set-AzureStorageBlobContent -File $blobFile
  </code></pre>
  
  <p>I've successfully been using a method similar to this to set Blob content after making a call to <code>Add-AzureRmAccount</code> to authenticate.</p>
  
  <p>I've also tried to use a Container SAS token but I keep getting a 403 error with that.</p>
  
  <p>The fact that the token works for a read leads me to believe that I'm missing something in my Powershell script  - can anyone shed any light on what that is?</p>