@@ -43,23 +43,16 @@ def __init__(self, client_id, username, **kwargs):
4343
4444 self ._account = accounts [0 ]
4545
46- def acquire_token (self , scopes , claims_challenge = None , data = None , ** kwargs ):
46+ def acquire_token (self , scopes , claims_challenge = None , ** kwargs ):
4747 # scopes must be a list.
4848 # For acquiring SSH certificate, scopes is ['https://pas.windows.net/CheckMyAccess/Linux/.default']
49- # data is only used for acquiring VM SSH certificate. DO NOT use it for other purposes.
5049 # kwargs is already sanitized by CredentialAdaptor, so it can be safely passed to MSAL
51- logger .debug ("UserCredential.acquire_token: scopes=%r, claims_challenge=%r, data=%r, kwargs=%r" ,
52- scopes , claims_challenge , data , kwargs )
50+ logger .debug ("UserCredential.acquire_token: scopes=%r, claims_challenge=%r, kwargs=%r" ,
51+ scopes , claims_challenge , kwargs )
5352
5453 if claims_challenge :
5554 logger .warning ('Acquiring new access token silently for tenant %s with claims challenge: %s' ,
5655 self ._msal_app .authority .tenant , claims_challenge )
57-
58- # Only pass data to MSAL if it is set. Passing data=None will cause failure in MSAL:
59- # AttributeError: 'NoneType' object has no attribute 'get'
60- if data is not None :
61- kwargs ['data' ] = data
62-
6356 result = self ._msal_app .acquire_token_silent_with_error (
6457 scopes , self ._account , claims_challenge = claims_challenge , ** kwargs )
6558
@@ -112,13 +105,8 @@ def __init__(self, client_id, client_credential, **kwargs):
112105 """
113106 self ._msal_app = ConfidentialClientApplication (client_id , client_credential = client_credential , ** kwargs )
114107
115- def acquire_token (self , scopes , data = None , ** kwargs ):
116- logger .debug ("ServicePrincipalCredential.acquire_token: scopes=%r, data=%r, kwargs=%r" ,
117- scopes , data , kwargs )
118-
119- if data is not None :
120- kwargs ['data' ] = data
121-
108+ def acquire_token (self , scopes , ** kwargs ):
109+ logger .debug ("ServicePrincipalCredential.acquire_token: scopes=%r, kwargs=%r" , scopes , kwargs )
122110 result = self ._msal_app .acquire_token_for_client (scopes , ** kwargs )
123111 check_result (result )
124112 return result
@@ -138,13 +126,8 @@ def __init__(self):
138126 # token_cache=...
139127 )
140128
141- def acquire_token (self , scopes , data = None , ** kwargs ):
142- logger .debug ("CloudShellCredential.acquire_token: scopes=%r, data=%r, kwargs=%r" ,
143- scopes , data , kwargs )
144-
145- if data is not None :
146- kwargs ['data' ] = data
147-
129+ def acquire_token (self , scopes , ** kwargs ):
130+ logger .debug ("CloudShellCredential.acquire_token: scopes=%r, kwargs=%r" , scopes , kwargs )
148131 result = self ._msal_app .acquire_token_interactive (scopes , prompt = "none" , ** kwargs )
149132 check_result (result , scopes = scopes )
150133 return result
@@ -164,13 +147,8 @@ def __init__(self, client_id=None, resource_id=None, object_id=None):
164147 managed_identity = SystemAssignedManagedIdentity ()
165148 self ._msal_client = ManagedIdentityClient (managed_identity , http_client = requests .Session ())
166149
167- def acquire_token (self , scopes , data = None , ** kwargs ):
168- logger .debug ("ManagedIdentityCredential.acquire_token: scopes=%r, data=%r, kwargs=%r" ,
169- scopes , data , kwargs )
170-
171- if data is not None :
172- from azure .cli .core .azclierror import AuthenticationError
173- raise AuthenticationError ("VM SSH currently doesn't support managed identity." )
150+ def acquire_token (self , scopes , ** kwargs ):
151+ logger .debug ("ManagedIdentityCredential.acquire_token: scopes=%r, kwargs=%r" , scopes , kwargs )
174152
175153 from .util import scopes_to_resource
176154 result = self ._msal_client .acquire_token_for_client (resource = scopes_to_resource (scopes ))
0 commit comments