Skip to content

[#114730201][#114888193] Automation for selecting subscription and tenant in authentication scenarios #1949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 16, 2016

Conversation

haocs
Copy link

@haocs haocs commented Mar 15, 2016

No description provided.

@haocs haocs changed the title Mock [#114730201][#114888193] Automation for selecting subscription and tenant in authentication scenarios Mar 15, 2016
@@ -121,8 +121,16 @@ public RMProfileClient(AzureRMProfile profile)
newTenant == null &&
TryGetTenantSubscription(token, account, environment, tenant, subscriptionId, subscriptionName, out tempSubscription, out tempTenant))
{
newTenant = tempTenant;
newSubscription = tempSubscription;
if (tempSubscription == null && i + 1 < tenants.Count())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the empty bock. You can invert the if to work for one case. Doesn't this work?

If( tempSubscription != null || i == (tenants.Count() -1) ) 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, this will change the logic of selecting the tenants. Now if tenant does not have any subscription - Last tenant will be selected. Somewhere in the code we say that "First subscription will be selected"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hovsepm

  • yes.
  • To keep the tenant selecting order, how about iterating tenants in a reverse fashion? Personally, I don't think "first tenant/subscription" makes much sense here if tenants are not sorted(or sorted alphabetically).

@markcowl
Copy link
Member

@azuresdkci add to whitelist

hovsepm pushed a commit that referenced this pull request Mar 16, 2016
[#114730201][#114888193] Automation for selecting subscription and tenant in authentication scenarios
@hovsepm hovsepm merged commit f330472 into Azure:dev Mar 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants