You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set default subscription via az account set --subscription <'AzureAccountName2'>command.
Run az group list -o table... to get a list of resource groups
Run any command that requires a resource group (rg) name
Observe cloud shell error stating that rg does not exist.
Chuckle as you verify that the named rg is the same as one you chose from the list obtained via az group list command. You find it humorous that the rg is not found ... because you copied and pasted it in the command parameter list from the list obtained viaaz group list command.
Notice then that cloud shell is not using the DEFAULT subscription set earlier via the az account set --subscription <'mySubscriptionName'> command.
For a sanity check run the az account show command to verify the default subscription is set as intended.
Note that the default subscription is set as expected.
For next sanity check rerun command requiring a rg name parameter and add -Debug parameter to get more details
Note that Azure cloud shell is running the command requiring a rg name in a NON-DEFAULT subscription.
(Optional Step) Scratch head and wonder 1) is azure picking a random subscription and ... well ... 2) (become philosophic now) why is the shell ignoring the default subscription setting; 3) is Azure shell behavior expected or a bug; 4) if this is expected (get philosophic again) why allow a default to be set in Azure cloud shell with no warning or level setting message if it is expected behavior that cloud shell ignores the DEFAULT subscription setting....
...
...
...
Commands you ran
1. az account list -o yaml
2. az account set --subscription 'POC Dev/Test Lab'
3. az account show -o yaml
4. az group list --query '[*].{Name:name, Location:location,Properties:properties,Type:type,ID:id }' -o yaml
5. $vnetgatewayHM = Get-AzVirtualNetworkGateway -Name vpn-palmtrio-prod-eastus-001 -resourcegroupname 'jenkins-prod-labs-rg' -debug
Here is a clear description of what is expected to happen instead:
Hi my name is klawrawkz. I am fine, how are you?
When I set a default subscription using the azure cloud-shell (or any other azure tooling), I expect that the commands I issue will be run in the context of the DEFAULT subscription. 1) Create session in cloud-shell; 2) Run command to set AZURE DEFAULT subscription; 3) issue any command under the sun; 4) from this point onward all commands in the session will be executed in the context of the DEFAULT subscription established in step 2.
Is this specific to Cloud Shell?
Yes, specific to cloud shell.
Interface information
How are you accessing Cloud Shell - https://portal.azure.com
Edge | Chrome | Opera | FireFox on Windows 10
Additional context
Here is additional context about the problem ==> *
We have set the 'default' subscription via cloud shell. When we execute: Get-AzVirtualNetworkGateway -Name vpn-palmtrio-prod-eastus-001 -resourcegroupname 'jenkins-prod-labs-rg' -debug this should or I expect to execute commands in the context of the DEFAULT subscription I.E. ID xx-xx-xx-0f7c8441bba8, .
To Reproduce
az account set --subscription <'AzureAccountName2'>
command.az group list -o table...
to get a list of resource groupsaz group list
command. You find it humorous that the rg is not found ... because you copied and pasted it in the command parameter list from the list obtained viaaz group list
command.az account set --subscription <'mySubscriptionName'>
command.az account show
command to verify the default subscription is set as intended.-Debug
parameter to get more details...
...
...
Commands you ran
Observed Behavior
Expected behavior
Here is a clear description of what is expected to happen instead:
Hi my name is klawrawkz. I am fine, how are you?
When I set a default subscription using the azure cloud-shell (or any other azure tooling), I expect that the commands I issue will be run in the context of the DEFAULT subscription. 1) Create session in cloud-shell; 2) Run command to set AZURE DEFAULT subscription; 3) issue any command under the sun; 4) from this point onward all commands in the session will be executed in the context of the DEFAULT subscription established in step 2.
Is this specific to Cloud Shell?
Yes, specific to cloud shell.
Interface information
How are you accessing Cloud Shell -
https://portal.azure.com
Edge | Chrome | Opera | FireFox on Windows 10
Additional context
Here is additional context about the problem ==> *
We have set the 'default' subscription via cloud shell. When we execute:
Get-AzVirtualNetworkGateway -Name vpn-palmtrio-prod-eastus-001 -resourcegroupname 'jenkins-prod-labs-rg' -debug
this should or I expect to execute commands in the context of the DEFAULT subscription I.E. ID xx-xx-xx-0f7c8441bba8, .NOTE: The trace of the request shows the command is executed using a NON-DEFAULT subscription ID, E.G. xx-xx-xx-xx-79216babb462, .
The command can never succeed because the subscription being queried for the RG is incorrect:
homeTenantId: xx-xx-xx-xx-801daa173b77
id: xx-xx-xx-xx-79216babb462
isDefault: false
managedByTenants: []
name:
state: Enabled
tenantId: xx-xx-xx-xx-801daa173b77
Thanks for your help with this.
klawrawkz
The text was updated successfully, but these errors were encountered: