Since we updated to Azure SKD 2.5 we can no longer update diagnostics configuration on role start. We instead are now using the Microsoft Azure PowerShell Cmdlets to update our web and worker role diagnostic configuration.
When developing our configuration script we noticed that calling Set-AzureServiceDiagnosticsExtension
without first calling Remove-AzureServiceDiagnosticsExtension
would fail with the following error:
VERBOSE: Setting default PaaSDiagnostics configuration for all roles.
VERBOSE: 10:01:19 AM - Begin Operation: Set-AzureServiceDiagnosticsExtension
Set-AzureServiceDiagnosticsExtension : BadRequest: Cannot add extension 'Default-PaaSDiagnostics-Production-Ext-0'
with same name space 'Microsoft.Azure.Diagnostics' and type 'PaaSDiagnostics' more than once.
At C:\Github\cloud-build\lib\UpdateDiagnosticsBuildStep.ps1:109 char:7
+ Set-AzureServiceDiagnosticsExtension -StorageContext $storageContext -Diag ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureServiceDiagnosticsExtension], CloudException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.SetAzureServiceDiagnosticsE
xtensionCommand
Ideally we could just call set to update the existing configuration. Is there a better way to do this that would not require us to have to call remove and set?
We have also noticed that our overall deploy time has roughly doubled as a result of updating the diagnostic configuration via powershell vs on role start. I think the increase can mostly be attributed to the roles restarting when the configuration is updated. Is there a way to avoid this?
Thanks!
Make sure you add -Role parameter when calling
Set-AzureServiceDiagnosticsExtension
.As Saurabh Bhatia pointed it out in a comment @Windows Azure Diagnostics – Upgrading from Azure SDK 2.4 to Azure SDK 2.5,