Adding support for Azure MSI user-assigned identity (#54884)

If more than one user-assigned identity is assigned to a host, then an identifier is required to specify which credentials are retrieved.  This change uses the existing support for client_id to retrieve the user-assigned identity by client_id.
pull/55699/head
Aaron D 6 years ago committed by Zim Kalinowski
parent 35fdae7485
commit 204db4d044

@ -1149,8 +1149,9 @@ class AzureRMAuth(object):
return None
def _get_msi_credentials(self, subscription_id_param=None):
credentials = MSIAuthentication()
def _get_msi_credentials(self, subscription_id_param=None, **kwargs):
client_id = kwargs.get('client_id', None)
credentials = MSIAuthentication(client_id=client_id)
subscription_id = subscription_id_param or os.environ.get(AZURE_CREDENTIAL_ENV_MAPPING['subscription_id'], None)
if not subscription_id:
try:
@ -1206,7 +1207,7 @@ class AzureRMAuth(object):
if auth_source == 'msi':
self.log('Retrieving credenitals from MSI')
return self._get_msi_credentials(arg_credentials['subscription_id'])
return self._get_msi_credentials(arg_credentials['subscription_id'], client_id=params.get('client_id', None))
if auth_source == 'cli':
if not HAS_AZURE_CLI_CORE:

Loading…
Cancel
Save