@@ -147,6 +147,7 @@ def login(self,
147147 password ,
148148 is_service_principal ,
149149 tenant ,
150+ get_subscriptions = None ,
150151 scopes = None ,
151152 use_device_code = False ,
152153 allow_no_subscriptions = False ,
@@ -199,7 +200,8 @@ def login(self,
199200 credential = identity .get_service_principal_credential (username )
200201
201202 if tenant :
202- subscriptions = subscription_finder .find_using_specific_tenant (tenant , credential )
203+ subscriptions = subscription_finder .find_using_specific_tenant (tenant , credential ,
204+ get_subscriptions = get_subscriptions )
203205 else :
204206 subscriptions = subscription_finder .find_using_common_tenant (username , credential )
205207
@@ -841,14 +843,21 @@ def find_using_common_tenant(self, username, credential=None):
841843 logger .warning ("%s" , t .tenant_id_name )
842844 return all_subscriptions
843845
844- def find_using_specific_tenant (self , tenant , credential , tenant_id_description = None ):
846+ def find_using_specific_tenant (self , tenant , credential , tenant_id_description = None , get_subscriptions = None ):
845847 """List subscriptions that can be accessed from a specific tenant.
846848 If called from find_using_common_tenant, tenant_id_description is TenantIdDescription retrieved from
847849 'Tenants - List' REST API. If directly called, tenant_id_description is None.
848850 """
849851 client = self ._create_subscription_client (credential )
850852 # https://learn.microsoft.com/en-us/rest/api/resources/subscriptions/list
851- subscriptions = client .subscriptions .list ()
853+
854+ subscriptions = []
855+ if get_subscriptions :
856+ for s in get_subscriptions :
857+ subscriptions .append (client .subscriptions .get (s ))
858+ else :
859+ subscriptions = client .subscriptions .list ()
860+
852861 all_subscriptions = []
853862 for s in subscriptions :
854863 _attach_token_tenant (s , tenant , tenant_id_description = tenant_id_description )
0 commit comments