Azure Microsoft.Azure.Diagnostics Extension
<p>Trying to configure the BootDiagnostics on a VM on a storage account in a resource group different from the VMs. To the best of my knowledge this can only be done by installing the VmDiagnosticsExtension. I'm executing the following:</p>

<pre><code>Set-AzureRmVMDiagnosticsExtension -ResourceGroupName $RgName -VMName $VmName `
                                  -DiagnosticsConfigurationPath 'D:\DiagnosticsConfig.xml' `
                                  -StorageAccountEndpoint '/subscriptions/ff26f7/resourceGroups/rgroup/providers/Microsoft.Storage/storageAccounts/amsdiag01'`
                                  -StorageAccountName 'amsdiag01' `
                                  -StorageAccountKey 'key''&gt; 
</code></pre>

<p>I get this error message:</p>

<blockquote>
  <p>ErrorMessage: Handler 'Microsoft.Azure.Diagnostics.IaaSDiagnostics'
  has reported failure for VM Extension
  'Microsoft.Insights.VMDiagnosticsSettings' with terminal error code
  '1009' and error message: 'Enable failed for plugin (name:
  Microsoft.Azure.Diagnostics.IaaSDiagnostics,  version 1.6.3.0) with
  exception Command
  C:\Packages\Plugins\Microsoft.Azure.Diagnostics.IaaSDiagnostics\1.6.3.0\DiagnosticsPluginLauncher.exe
  of Microsoft.Azure.Diagnostics.IaaSDiagnostics has exited with Exit
  code: -106'</p>
</blockquote>

<p>No further information available in <code>C:\WindowsAzure\Logs\WaAppAgent.log</code> on server. In the portal under 'Diagnostics' I can see the correct configuration. But the extension is in a '(unavailable)' state. Container in storage account is not created. Also, can't reboot the server due to the extension. I can remove and re-add the extension using PowerShell, but always same result. When performing a <code>Get-AzureRmVMExtension</code> I see the following 'Public Settings' entry:</p>

<blockquote>
  <p>PublicSettings     : {
                         "storageAccount": "amsdiag01",
                         "xmlCfg": "PFdhZENmZz4NCiAgICAgIDxEaWFnbm9zdGljTW9uaXRvckNvbmZpZ3VyYXRpb24gb3ZlcmFsbFF1b3RhSW5NQj0iNDA5NiI+DQogICAgICAgIDxQZXJmb3JtYW5jZUNvdW50ZXJzIHNjaGVkdWxlZFRyYW5zZmVyUGVyaW9kPSJQVDFNIj4NCsKgwqDCoMKgwqAgICAgIDxQZXJmb3JtYW5jZUNvdW50ZXJDb25maWd1cmF0aW9uIGNvdW>                      eU5hbWU9IkNQVSBwcml2aWxlZ2VkIHRpbWUiIGxvY2FsZT0i</p>
</blockquote>