I'm following the Microsoft Documentation on how to set up Continuous Exports for AppInsights on Azure.
My current script looks like this:
[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 > $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
When running the scrip and checking the portal I can see it was created:

The problem:
The script turned on Request and Exception (supplied by me for the $docType parameter) but neither the Storage location or the Storage container were set up properly. I'm not sure what is happening here.

This is by design(even though I don't know why, it is weird).
Even when you manually create the continuous exports by UI from the azure portal, you can see the same behavior. But it works and data will be sent to the storage container you defined previously.
And as far as I know, you can use this powershell cmdlet Get-AzApplicationInsightsContinuousExport to check the storage container / Storage location.
Sample powershell code:
$s = Get-AzApplicationInsightsContinuousExport -ResourceGroupName your_resourceGroupName -Name your_app_insights_name
# get the storage container name
$s.ContainerName
# get the Storage location name
$s.DestinationStorageLocationId
# get the storage account name
$s.StorageName
Test result as below:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With