10

I’m keep getting the above error when trying to execute Start-AzureService.

Following information prompted when executing Get-AzureAccount:

Id                    Type Subscriptions                        Tenants                               
--                    ---- -------------                        -------                               
Me@outlook.com User   12345678-1234-5678-9012-345678901235 {12345678-1234-5678-9012-345678901235} 

And following information prompted when executing Get-AzureSubscription:

SubscriptionId            : 12345678-1234-5678-9012-345678901235
SubscriptionName          : My Production (Pay-As-You-Go)
Environment               : MyCloud
DefaultAccount            : Me@outlook.com
IsDefault                 : True
IsCurrent                 : True
TenantId                  : 12345678-1234-5678-9012-345678901235
CurrentStorageAccountName :  


Select-AzureSubscription : Parameter set cannot be resolved using the specified named parameters.

is prompted when When I try to follow the suggested command:

Select-AzureSubscription -Default "My Production (Pay-As-You-Go)"
David Makogon
  • 69,407
  • 21
  • 141
  • 189
albertsha
  • 189
  • 1
  • 2
  • 15

2 Answers2

14

Use this one to select your default subscription:

Select-AzureSubscription -Default -SubscriptionName "My Production (Pay-As-You-Go)"

You can also choose to use -SubscriptionId (and the GUID) instead of the name.

For more information on the Select-AzureSubscription commandlet; type Get-Help Select-AzureSubscription .

If this doesn't work, try running first, before selecting your subscription:

 Add-AzureAccount 

Update if you're still facing trouble:

If you are using AzureRM / with old cmdlets (or just AzureRM) and are still facing problems I would strongly recommend you to check if you have multiple versions of AzureRM.Profile module . I've encountered this numerous times when one version is installed under Program Files and another under my user profile (or somewhere else in PSModulePath).

To list what modules / versions are installed :

Get-Module AzureRm.Profile -ListAvailable

If you have multiple instances and versions of this it might create some trouble with some of your cmdlets.

Harald F.
  • 4,505
  • 24
  • 29
  • 1
    To get help, it's actually `Get-Help`. – David Makogon Jun 19 '16 at 20:33
  • 1
    Hi CmdrTchort, Not helps. Using Select-AzureSubscription -Default -SubscriptionName "My Production (Pay-As-You-Go)" prompts we with "WARNING: Current and Default parameters have been deprecated. Select-AzureSubscription will always update the Default Subscription" and Start-AzureService : No default subscription has been designated. When afterword’s try to use Select-AzureSubscription -Default to set the default subscription. is prompted again when trying to use Start-AzureService -PassThru -Profile STAGING -ServiceName myService. – albertsha Jun 20 '16 at 06:49
8

When I tried to Select-AzureSubscription it was giving me the error "Subscription does not exist" when I was passing 100% correct subscription name or subscription Id that I found on Azure portal and from powershell:

$account = Login-AzureRmAccount
$account.Context.Subscription.SubscriptionId
$account.Context.Subscription.SubscriptionName

Adding Azure account fixed the problem for me:

Add-AzureAccount
Andrei
  • 42,814
  • 35
  • 154
  • 218