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.
We use cookies and other similar technology to collect data to improve your experience on our site, as described in our Privacy Policy and Cookie Policy. az cloud list: List registered clouds. Core GA az cloud list-profiles: List the supported profiles for a cloud. Core GA az cloud register: Register a cloud. Core GA az cloud set: Set the active cloud. Core GA az cloud show: Get the details of a registered cloud. Core GA az cloud unregister: Unregister a cloud. Core GA az cloud updateOpen Cloudshell. az config set core.collect_telemetry=true. Turn on file logging and set its location. Azure CLI. Open Cloudshell. az config set logging.enable_log_file=true az config set logging.log_dir=~/az-logs. Set the default location to `westus2` and default resource group to `myRG`.
And now when I run az account list again, it shows me both subscriptions. One addition comment / observation. Once the az login / az account set has been run with the desired subscription id, i've noticed that I can remove the az login and account set logic from the script and it just uses the cached values.
az login # set variables location="centralus" subscription="{subscription-id}" rg="fic-test-rg" # user assigned identity name uaId="fic-test-ua" # federated identity credential name ficId="fic-test-fic-name" # create prerequisites if required. # otherwise make sure that existing resources names are set in variables above az account setThis command queries the user's currently active Entra ID roles, therefore including all statically assigned roles (in addition to roles currently enabled via PIM). The command already respects roles that come via role assignable groups. We add two additional properties to make the output more digestable.