Open egelke opened 4 years ago
add to S174
I have no idea what is wrong with my Azure account, but I had a similar issue where I needed to specify my tenant... but I didn't know what my tenant was... to find it, I looked at a subscription I wanted to use from the CLI and and noted the Default Directory. Let's say my account email was user@foo.com, then my Directory was userfoocom@onmicrosoft.com. Then, using this cli login worked:
az login -t userfoocom@onmicrosoft.com
Describe the bug When running:
az login
It gives the warning
It does not actually login.
In order for it to work I need to provide my tenant:
az login -t egelke.net
To Reproduce Setup an AAD B2C as specified by the doc: https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-tenant Note that is did it quite a while ago and at that time it was mandatory to first create your tenant and then link it to your existing subscription.
Set the default directory in the azure portal to the corporate (not B2C) directory.
Run:
az login
You should get the warning and not be logged in. Note that it might work in your case depending on the order the tenants are returned by the the
https://management.azure.com/tenants?api-version=2020-01-01
service.Expected behavior To find my subscription, without having to specify the tenant.
It is a very standard setup, I just have the ADD B2C service enabled in the documented way. There should be no issue for the CLI to handle this situation without the need provide any additional info.
Environment summary Linux-5.4.0-40-generic-x86_64-with-debian-bullseye-sid Python 3.6.10 Installer: DEB { "azure-cli": "2.8.0", "azure-cli-command-modules-nspkg": "2.0.3", "azure-cli-core": "2.8.0", "azure-cli-nspkg": "3.0.4", "azure-cli-telemetry": "1.0.4", "extensions": {} }
Additional context
az login --debug
learned that it first retrieves the list of tenant and then retrieves the subscriptions from both tenants. The first egelke.net tanant returns my subscription, but although the AAD B2C tenant (egelkeIdp.onmicrosoft.com) is linked to the same subscription the service does not return it. (I verified everyting via https://docs.microsoft.com/en-us/rest/api/resources/) In this particular case the CLI seems to have "forgotten" the subscriptions returned by the first tenant while it should have merged the 2 lists and find the sole subscription.Below a snipped of the logs: