title: How to properly set up Continuous Exports on App Insights with powershell script?
body: <p>I'm following the Microsoft Documentation on how to set up <strong>Continuous Exports</strong> for AppInsights on Azure.</p>
  
  <p>My current script looks like this:</p>
  
  <pre><code>[CmdletBinding()]
  Param(
      [Parameter(Mandatory=$True)]
      [String]$resourceGroupName,
  
      [Parameter(Mandatory=$True)]
      [String]$appInsightsName,
  
      [Parameter(Mandatory=$True)]
      [String[]]$docTypes,
  
      [Parameter(Mandatory=$True)]
      [String]$storageAccountName,
  
      [Parameter(Mandatory=$True)]
      [String]$continuousExportContainerName
  
  )
  
  Login-AzureSubscription &gt; $Null
  
  $storage = Get-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name $storageAccountName
  $continuousExportContainer = Get-AzureStorageContainer -Context $storage.Context -Name $continuousExportContainerName
  $sasToken = New-AzureStorageContainerSASToken -Name testcontainer -Context $storage.Context -ExpiryTime (Get-Date).AddYears(50) -Permission "rwdl"
  $sasUri = $continuousExportContainer.CloudBlobContainer.Uri.AbsoluteUri + $sasToken
  $defaultLocation = Get-DataCenterLocation us AppInsights
  
  New-AzureRmApplicationInsightsContinuousExport -ResourceGroupName $resourceGroupName -Name $appInsightsName -DocumentType $docTypes -StorageAccountId $storage.Id -StorageLocation $defaultLocation -StorageSASUri $sasUri
  </code></pre>
  
  <p>When running the scrip and checking the portal I can see it was created:</p>
  
  <p><a href="https://i.stack.imgur.com/CfJ6E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CfJ6E.png" alt="enter image description here"></a></p>
  
  <p><strong>The problem:</strong></p>
  
  <p>The script turned on Request and Exception (supplied by me for the $docType parameter) but <strong>neither the Storage location or the Storage container were set up</strong> properly.
  I'm not sure what is happening here.</p>
  
  <p><a href="https://i.stack.imgur.com/bRmVK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bRmVK.png" alt="enter image description here"></a></p>