/// <summary> /// Gets the subscriptions. /// </summary> /// <returns></returns> private IEnumerable <string> GetSubscriptions() { if (this.Subscription != null) { return(this.Subscription); } // Use selected subscription (for example, by command "Select-AzSubscription {subscriptionId}") if (this.TryGetDefaultContext(out var context)) { var subscriptionId = context.Subscription?.Id; if (subscriptionId != null) { return(new List <string> { subscriptionId }); } } var accountSubscriptions = this.DefaultContext.Account.GetSubscriptions(); if (accountSubscriptions.Length > 0) { return(accountSubscriptions); } return(SubscriptionCache.GetSubscriptions(this.DefaultContext)); }
/// <summary> /// Gets the subscriptions. /// </summary> /// <returns></returns> private IEnumerable <string> GetSubscriptions() { if (this.Subscription != null) { return(this.Subscription); } var accountSubscriptions = this.DefaultContext.Account.GetSubscriptions(); if (accountSubscriptions.Length > 0) { return(accountSubscriptions); } return(SubscriptionCache.GetSubscriptions(this.DefaultContext)); }