@Pratik Khasnabis
Thank you for your time and patience!
Based off your issue, I tested this scenario out on my end and will post my findings below.
Findings:
Using Bash within the Azure Portal - I was able to sign into another Azure AD tenant (using username and password), from a different tenant. However, in order to switch between tenants, I had to re-run az-login
.
Azure CLI - I was only able to use it with one user at a time. I logged in with two separate users, using two separate Command prompts, and after logging in with the second user, the first Command prompt, would output the secondary user's info.
Green box - I signed into Azure CLI initially with my Outlook user, and ran az account tenant list
Orange box - I signed in with my secondary user within another tenant and re-ran the same commands.
Since this issue is more related to Azure CLI than Azure RBAC, and because Q&A doesn't have an azure-cli
tag as you mentioned, you can reach out to our Azure CLI experts via their Stack Overflow forum, to see if there are any easier ways to switch between tenants - Questions tagged azure-cli. Additionally, if you'd like something similar to the AWS CLI named profiles feature to be implemented, I'd recommend creating a feature request with our Azure CLI team via their GitHub link - Issue: Feature request.
Additional Links:
Can I access multiple azure accounts with azure-cli from same machine at same time?
AZURE CLI BASICS: LOGGING IN - 3rd party link
If you have any other questions, please let me know.
Thank you for your time and patience throughout this issue.
----------
Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.