Calling Set-AzureServiceDiagnosticsExtension with

2019-04-10 01:28发布

I'm trying to set Azure diagnostics on a deployed cloud service using the Azure Powershell cmdlets and the Set-AzureServiceDiagnosticsExtension command:

Set-AzureServiceDiagnosticsExtension -StorageContext $storageContext -DiagnosticsConfigurationPath $diagnosticsConfiguration.FullName -ServiceName $serviceName -Slot Production -Role "MyService.Web"-Verbose

Doing so I get the following error

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

It works when I don't use the "-Role" parameter but then I have to call Remove-AzureServiceDiagnosticsExtension for each role prior to calling the Set command which adds 2-3 minutes per role to the script execution time.

The Role parameter matches my role name in the Azure Cloud Service. Am I doing something wrong?

1条回答
迷人小祖宗
2楼-- · 2019-04-10 02:15

This doesn't like . in the Role name

Change to underscore and it will work

Its a bug in powershell that they will fix next time

查看更多
登录 后发表回答