private IEnumerable <AzureSubscription> ListAllSubscriptionsForTenant( string tenantId) { IAzureAccount account = _profile.DefaultContext.Account; IAzureEnvironment environment = _profile.DefaultContext.Environment; SecureString password = null; string promptBehavior = ShowDialog.Never; IAccessToken accessToken = null; try { accessToken = AcquireAccessToken(account, environment, tenantId, password, promptBehavior, null); } catch { WriteWarningMessage(string.Format(ProfileMessages.UnableToAqcuireToken, tenantId)); return(new List <AzureSubscription>()); } SubscriptionClient subscriptionClient = null; subscriptionClient = AzureSession.Instance.ClientFactory.CreateCustomArmClient <SubscriptionClient>( environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ResourceManager), new TokenCredentials(accessToken.AccessToken) as ServiceClientCredentials, AzureSession.Instance.ClientFactory.GetCustomHandlers()); AzureContext context = new AzureContext(_profile.DefaultContext.Subscription, account, environment, CreateTenantFromString(tenantId, accessToken.TenantId)); return(subscriptionClient.ListAll().Select(s => s.ToAzureSubscription(context))); }