Azure Cli how to change subscription default

I have 3 subscription in my Azure Account, I need to change the default subscription. When i Run the command:

azure account list 

I have this output:

enter image description here

I have tried to change the default or current subscription on this way, with no results...

azure config set subscription {{MyIdSubscription}}

Any ideas? Thanks.


Solution 1:

For Azure CLI 2.0 (preview) I had to use

az account set --subscription <name or id>

Solution 2:

Please try the following:

azure account set -s {Subscription Id}

That should change the subscription.

Solution 3:

1. List all the subscriptions you have

    az account list --output table
    
      Name             CloudName     SubscriptionId     State     IsDefault
    ---------------   ------------  ----------------  ---------  ----------
    AssociateProd      AzureCloud    xxxxxxxxxxxx       Enabled    False

2. Pick the subscription you want and use it in the command below.

    az account set --subscription <subscription_id>

Solution 4:

Try in this way.it worked for me to set Azure PowerShell to a specific Azure Subscription

Set-AzContext -SubscriptionId "t666-e251-49ce-a1cd-5c3144"