0
votes

I'm trying to update the diagnostics configuration for an Azure Cloud Service with the following command...

$storage = New-AzureStorageContext -StorageAccountName {storageName} -StorageAccountKey {storage key}
Set-AzureServiceDiagnosticsExtension -ServiceName MyCloudServiceName -StorageContext $storage -Role {my role name} -Slot Production -DiagnosticsConfigurationPath MyWorkerRoleContent\diagnosticsUAT.wadcfgx

Which fails with the following error...

Set-AzureServiceDiagnosticsExtension : Deployment not found in service: MyCloudServiceName and slot: Production. At line:1 char:1 + Set-AzureServiceDiagnosticsExtension -ServiceName MyCloudServiceName ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Set-AzureServiceDiagnosticsExtension], Exception + FullyQualifiedErrorId : System.Exception,Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions.SetAzureSe rviceDiagnosticsExtensionCommand

I've actually had success with the exact same commands but on another azure subscription (and obviously different cloud service names and keys). I've tried creating a staging slot and using the command on the staging slot. I've also tried omitting the slot altogether, all with the same result.

Has anyone encountered this issue and have any insight on how to rectify it?

2

2 Answers

1
votes

This issue has also been posted on GitHub where it was resolved, see here: https://github.com/Azure/azure-powershell/issues/2538#issuecomment-229822864

1
votes

The issue was related to having multiple Azure subscriptions registered in PowerShell.

When you run Add-AzureAccount, PowerShell permanently retains the credentials. You can close PowerShell, log off the machine, shut it down etc, PowerShell retains access to the subscription. This is something I didn't realise.

Also after running Add-AzureAccount, if other subscriptions have already been registered, you will not be able to access resources in the added subscription until you've selected it as the default using Select-AzureSubscription.