我正在尝试使用以下命令更新Azure Cloud 服务的诊断配置...
$storage = New-AzureStorageContext -StorageAccountName {storageName} -StorageAccountKey {storage key}
Set-AzureServiceDiagnosticsExtension -ServiceName MyCloudServiceName -StorageContext $storage -Role {my role name} -Slot Production -DiagnosticsConfigurationPath MyWorkerRoleContent\diagnosticsUAT.wadcfgx
哪个失败,出现以下错误...
Set-AzureServiceDiagnosticsExtension:在服务中找不到部署:MyCloudServiceName和slot:Production . 在行:1 char:1 Set-AzureServiceDiagnosticsExtension -ServiceName MyCloudServiceName ... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~分类信息:NotSpecified :( :) [Set-AzureServiceDiagnosticsExtension],异常FullyQualifiedErrorId!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :System.Exception,Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.SetAzureSe rviceDiagnosticsExtensionCommand
我实际上已经使用完全相同的命令但是在另一个azure订阅(显然不同的 Cloud 服务名称和密钥)上取得了成功 . 我已经尝试创建一个临时插槽并在暂存插槽上使用该命令 . 我也试过完全省略插槽,所有都有相同的结果 .
有没有人遇到过这个问题并对如何纠正它有任何见解?
2 回答
此问题也已发布在GitHub上,已在此处解决,请参见此处:https://github.com/Azure/azure-powershell/issues/2538#issuecomment-229822864
该问题与在PowerShell中注册多个Azure订阅有关 .
运行Add-AzureAccount时,PowerShell将永久保留凭据 . 您可以关闭PowerShell,注销计算机,关闭它等,PowerShell保留对订阅的访问权限 . 这是我没有意识到的 .
此外,在运行Add-AzureAccount之后,如果已经注册了其他订阅,则在使用Select-AzureSubscription将其选为默认订阅之前,您将无法访问添加的订阅中的资源 .