Closed artisticcheese closed 1 year ago
I cannot repro this. Are you still seeing this issue? What if the output of $env:ACC_VERSION
in Cloud Shell?
Yes, still seeing this requested output is below
PS Azure:\> $env:ACC_VERSION
master_20190614.1
Azure:/
PS Azure:\> Get-AzSubscription
Name Id TenantId State
---- -- -------- -----
Mcafee MSDN b55607ab-c703-4044-a526-72bd701b0d48 c0de79f3-23e2-4f18-989e-d173e1d403d6 Enabled
NTT Data Subscription 8211cd03-4f97-4ee6-af42-38cad1387992 c0de79f3-23e2-4f18-989e-d173e1d403d6 Enabled
Azure:/
PS Azure:\> Select-AzSubscription "NTT Data Subscription" -Verbose
VERBOSE: Switching targeted subscription in the context to 'NTT Data Subscription'
Name Account SubscriptionName Environment TenantId
---- ------- ---------------- ----------- --------
Mcafee MSDN (b55607ab-c703-4044-a526-72… MSI@50342 Mcafee MSDN AzureCloud c0de79f3-23e2-4f18-989e-d173e1d403d6
Can you supply the Id instead of the name?
Does not work either
PS Azure:\> Select-AzSubscription -SubscriptionId 8211cd03-4f97-4ee6-af42-38cad1387992 -Verbose
VERBOSE: Switching targeted subscription in the context to '8211cd03-4f97-4ee6-af42-38cad1387992'
Name Account SubscriptionName Environment TenantId
---- ------- ---------------- ----------- --------
Mcafee MSDN (b55607ab-c703-4044-a526-72… MSI@50342 Mcafee MSDN AzureCloud c0de79f3-23e2-4f18-989e-d173e1d403d6
I am having the same issue. I found a workaround was to use Select-AzureRmContext instead as there were precreated contexts for each of my subscriptions.
I'm having the same issue PS Azure:> $env:ACC_VERSION master_20191213.3
Got some great tips from some fellow MVPs that I don't have the GitHub alias for. They deserve all credit for this one.
Following solved it for me
Clear-AzContext
# https://docs.microsoft.com/en-us/powershell/module/az.accounts/clear-azcontext?view=azps-3.3.0
# Remove all Azure credentials, account, and subscription information.
Connect-AzAccount
# https://docs.microsoft.com/en-us/powershell/module/az.accounts/connect-azaccount?view=azps-3.3.0
# Connect to Azure with an authenticated account for use with Azure Resource Manager cmdlet requests.
Set-AzContext
and Select-AzSubscription
should work again
This is happening to me too
$env:ACC_VERSION master_20200306.3
This has been happening for a while now. I don't think this should be desired behavior. It is causing working local PS code to fail in Cloud Shell, since you cannot automate changing context for multi subscription environments. Using the Clear-AzContext then Connect-AzAccount is a really clunky work-around.
$env:ACC_VERSION master_20200424.2
Connect-AzAccount also fails hence no way to switch subscription on cloud shell. https://github.com/Azure/azure-powershell/issues/13340
This problem no longer exists.
Not sure when it stopped working but it's impossible to switch context in cloudshell to different subscription
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.