使用角色参数调用Set-AzureServiceDiagnosticsExtension失败

使用角色参数调用Set-AzureServiceDiagnosticsExtension失败,azure,azure-diagnostics,azure-powershell,azure-deployment,Azure,Azure Diagnostics,Azure Powershell,Azure Deployment,我正在尝试使用Azure Powershell cmdlet和set-AzureServiceDiagnosticsExtension命令在已部署的云服务上设置Azure诊断: Set-AzureServiceDiagnosticsExtension -StorageContext $storageContext -DiagnosticsConfigurationPath $diagnosticsConfiguration.FullName -ServiceName $serviceName -

我正在尝试使用Azure Powershell cmdlet和set-AzureServiceDiagnosticsExtension命令在已部署的云服务上设置Azure诊断:

Set-AzureServiceDiagnosticsExtension -StorageContext $storageContext -DiagnosticsConfigurationPath $diagnosticsConfiguration.FullName -ServiceName $serviceName -Slot Production -Role "MyService.Web"-Verbose
这样做会导致以下错误

Exception: Microsoft.WindowsAzure.CloudException: BadRequest: The extension ID
MyService.Web-PaaSDiagnostics-Production-Ext-0 is invalid.
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task
task)
   at Microsoft.WindowsAzure.HostedServiceOperationsExtensions.AddExtension(IHo
stedServiceOperations operations, String serviceName,
HostedServiceAddExtensionParameters parameters)
   at Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.ExtensionMan
ager.AddExtension(HostedServiceAddExtensionParameters extensionInput)
   at Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.ExtensionMan
ager.InstallExtension(ExtensionConfigurationInput context, String slot,
ExtensionConfiguration extConfig)
   at Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.SetAzureServ
iceDiagnosticsExtensionCommand.ExecuteCommand()
   at Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.SetAzureServ
iceDiagnosticsExtensionCommand.OnProcessRecord()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.CloudBaseCmdlet`1.Proces
sRecord()
   at System.Management.Automation.Cmdlet.DoProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorExcep
   tion
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
   n,UpdateDiagnosticsBuildStep.ps1
当我不使用“-Role”参数时,它可以工作,但是在调用Set命令之前,我必须为每个角色调用Remove-AzureServiceDiagnosticsExtension,这会为每个角色增加2-3分钟的脚本执行时间


Role参数与Azure云服务中的我的角色名匹配。我做错什么了吗?

这不太像。在角色名中

更改为下划线,它将起作用


这是powershell中的一个bug,他们将在下次修复它

有结果吗?我也有同样的问题。我的工作人员角色,但不是一个网络角色。不,这是一个公认的错误从微软。你可以在这里看到我关于这个bug的问题和他们建议的解决方法:你的自定义日志传输吗?我仍然无法按计划传输我的nlog日志。事件日志中没有错误。这是很痛苦的。是的,我所有的常规跟踪日志都采用了一种变通方法,即在我可以设置诊断配置之前,必须先调用
Remove
。您可以通过在服务级别应用诊断来解决这一问题(只需省略-Role参数),该参数将对所有角色执行,如果尝试将其应用于名称中带有“.”的特定角色,则会失败。