【问题标题】:Azure PowerShell Cmdlets and Setting Service Diagnostics (Set-AzureServiceDiagnosticsExtension)Azure PowerShell Cmdlet 和设置服务诊断 (Set-AzureServiceDiagnosticsExtension)
【发布时间】:2014-12-22 15:10:19
【问题描述】:

自从我们更新到 Azure SKD 2.5 后,我们无法再在角色启动时更新诊断配置。相反,我们现在使用 Microsoft Azure PowerShell Cmdlet 来更新我们的 Web 和辅助角色诊断配置。

在开发我们的配置脚本时,我们注意到在没有先调用 Remove-AzureServiceDiagnosticsExtension 的情况下调用 Set-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

理想情况下,我们可以调用 set 来更新现有配置。有没有更好的方法来做到这一点,不需要我们调用 remove 和 set?

我们还注意到,由于通过 powershell 更新诊断配置而不是在角色启动时更新诊断配置,我们的整体部署时间大约增加了一倍。我认为增加的主要原因是配置更新时角色重新启动。有没有办法避免这种情况?

谢谢!

【问题讨论】:

    标签: azure azure-diagnostics azure-powershell azure-deployment


    【解决方案1】:

    确保在调用Set-AzureServiceDiagnosticsExtension时添加-Role参数。

    正如Saurabh Bhatia在评论@Windows Azure Diagnostics – Upgrading from Azure SDK 2.4 to Azure SDK 2.5中指出的那样,

    对于 Powershell 脚本,请确保在设置扩展时明确传入 -Role。如果扩展已经存在并且您没有明确传递角色,那么您可能会看到提到的错误。

    同样地,当您删除扩展时,请确保明确传递您要从中删除扩展的 -role。

    如果任何角色上都没有诊断扩展,那么您可以在没有角色的情况下调用设置扩展 ps 来为所有角色设置扩展。

    【讨论】:

    【解决方案2】:

    正如 Kevin Williamson [MSFT] 在他的博文中所描述的:

    当您使用 Visual Studio 对 WAD 配置进行部署后更新时,首先使用 Get Extension API 下载扩展配置以获取当前配置,然后添加扩展 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

    【讨论】:

      猜你喜欢
      • 2014-01-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-21
      • 2023-03-10
      • 2021-02-23
      • 2020-09-06
      相关资源
      最近更新 更多