Skip to content

Commit

Permalink
[fixes #103937270] Add -SubscriptionName to Get-AzureRMSubscription
Browse files Browse the repository at this point in the history
  • Loading branch information
jianghaolu committed Sep 23, 2015
1 parent 392e3fd commit 81bab9e
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,19 @@ public bool TryGetSubscription(string tenantId, string subscriptionId, out Azure
tenantId, subscriptionId, out subscription, out tenant);
}

public bool TryGetSubscriptionByName(string tenantId, string subscriptionName, out AzureSubscription subscription)
{
if (string.IsNullOrWhiteSpace(tenantId))
{
throw new ArgumentNullException("Please provide a valid tenant Id.");
}

IEnumerable<AzureSubscription> subscriptionList = ListSubscriptions(tenantId);
subscription = subscriptionList.FirstOrDefault(s => s.Name.Equals(subscriptionName, StringComparison.OrdinalIgnoreCase));

return subscription != null;
}

public AzureEnvironment AddOrSetEnvironment(AzureEnvironment environment)
{
if (environment == null)
Expand Down
Loading

0 comments on commit 81bab9e

Please sign in to comment.