diff --git a/lib/ansible/module_utils/azure_rm_common.py b/lib/ansible/module_utils/azure_rm_common.py index 0115e31c69..a25fa12cdd 100644 --- a/lib/ansible/module_utils/azure_rm_common.py +++ b/lib/ansible/module_utils/azure_rm_common.py @@ -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: