简体   繁体   English

Azure PowerShell Cmdlet和设置服务诊断(Set-AzureServiceDiagnosticsExtension)

[英]Azure PowerShell Cmdlets and Setting Service Diagnostics (Set-AzureServiceDiagnosticsExtension)

Since we updated to Azure SKD 2.5 we can no longer update diagnostics configuration on role start. 自从我们更新到Azure SKD 2.5后,我们无法再更新角色启动时的诊断配置。 We instead are now using the Microsoft Azure PowerShell Cmdlets to update our web and worker role diagnostic configuration. 我们现在使用Microsoft Azure PowerShell Cmdlet来更新我们的Web和辅助角色诊断配置。

When developing our configuration script we noticed that calling Set-AzureServiceDiagnosticsExtension without first calling Remove-AzureServiceDiagnosticsExtension would fail with the following error: 在开发我们的配置脚本时,我们注意到在没有先调用Remove-AzureServiceDiagnosticsExtension情况下调用Set-AzureServiceDiagnosticsExtension Remove-AzureServiceDiagnosticsExtension会失败,并显示以下错误:

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. 理想情况下,我们可以调用set来更新现有配置。 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. 我们还注意到,由于通过powershell和角色启动更新诊断配置,我们的整体部署时间大约翻了一番。 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 . 请确保在调用时添加-Role参数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 , 正如Saurabh Bhatia在评论@Windows Azure Diagnostics中指出的那样- 从Azure SDK 2.4升级到Azure SDK 2.5

For the Powershell Script please make sure to explicitly pass in a -Role when you set the extension. 对于Powershell脚本,请确保在设置扩展时明确传入-Role。 If an extension already exists and if you don't pass in the role explicitly then you may see the error mentioned. 如果扩展已经存在,并且您没有明确传入该角色,那么您可能会看到提到的错误。

Similarly when you remove the extension make sure to explicitly pass in the -role from which you want to remove the extension. 同样,当您删除扩展名时,请确保明确传入要从中删除扩展名的-role。

If no diagnostic extension is present on any of the roles then you can call the set extension ps without the Role to set the extension on all roles. 如果任何角色上都没有诊断扩展,则可以调用set extension ps而不使用Role在所有角色上设置扩展。

As Kevin Williamson [MSFT] describes in his blog post: 正如Kevin Williamson [MSFT]在他的博客文章中描述的那样:

When you do post-deployment updates to the WAD configuration using Visual Studio it is first downloading the extension configuration using Get Extension API to get the current config, then Add Extension API to update a new config, then Change Deployment Configuration to associate the new extension config to the service, and then Delete Extension to delete the old extension configuration. 当您使用Visual Studio对WAD配置进行部署后更新时,首先使用Get Extension API下载扩展配置以获取当前配置,然后使用Add Extension API更新新配置,然后更改部署配置以关联新扩展配置服务,然后删除扩展以删除旧的扩展配置。

http://blogs.msdn.com/b/kwill/archive/2014/12/02/windows-azure-diagnostics-upgrading-from-azure-sdk-2-4-to-azure-sdk-2-5.aspx http://blogs.msdn.com/b/kwill/archive/2014/12/02/windows-azure-diagnostics-upgrading-from-azure-sdk-2-4-to-azure-sdk-2-5。 ASPX

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM