protected async Task<IEnumerable<IAzureSubscriptionContext>> GetSubscriptionContextsAsync()
{
IEnumerable<IAzureSubscriptionContext> subscriptions = Enumerable.Empty<IAzureSubscriptionContext>();
Account account = await this.GetAccountAsync();
if (account != null && !account.NeedsReauthentication)
{
IAzureUserAccount azureUserAccount = this.accountPickerViewModel.AuthenticationManager.UserAccounts.FirstOrDefault(a => a.UniqueId == account.UniqueId);
if (azureUserAccount != null)
{
try
{
subscriptions = await azureUserAccount.GetSubscriptionsAsync(false).ConfigureAwait(false);
}
catch (Exception)
{
// User cancelled out of the login prompt, etc. - ignore exception and return no subscriptions
}
}
}
return subscriptions;
}