Changing the default subscription in Azure

Samaneh Mahdavifar 20 Reputation points
2023-09-18T16:55:52.7933333+00:00

I currently have three subscriptions in Azure. Apparently, one of the subscriptions is the default one.
I was wondering how I would be able to change my default subscription to another one permanently.

I do not want to do it in each session I connect to Azure. In this case, the default session reverts back to the original.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,712 questions
{count} votes

Accepted answer
  1. Patchfox 3,926 Reputation points
    2023-09-18T17:50:20.9033333+00:00

    Hello, unfortunately, this is no longer possible with the new Powershell module as well as the Azure CLI.

    The context can be changed with Set-AzContext https://learn.microsoft.com/en-us/powershell/module/az.accounts/set-azcontext?view=azps-10.3.0

    As soon as a logout is performed or the session is generally terminated, it is reset to the original default subscription.


    If the reply was helpful, please don’t forget to upvote or accept it as an answer, thank you!

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Samaneh Mahdavifar 20 Reputation points
    2023-09-18T18:01:20.1533333+00:00

    Thank you!

    Actually, I have changed the current active subscription using "az account set --subscription" through PowerShell; but as you have also mentioned, as soon as the session is terminated, it is reset to the original default subscription.

    I was looking for a permanent solution.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.