diff --git a/salt/cloud/clouds/azurearm.py b/salt/cloud/clouds/azurearm.py index bd9a25a7e2..cd64115f50 100644 --- a/salt/cloud/clouds/azurearm.py +++ b/salt/cloud/clouds/azurearm.py @@ -60,6 +60,7 @@ import logging import pprint import base64 import collections +import pkgutil import salt.cache import salt.config as config import salt.utils.cloud @@ -117,9 +118,12 @@ try: from azure.mgmt.storage import StorageManagementClient from azure.mgmt.web import WebSiteManagementClient from msrestazure.azure_exceptions import CloudError - from azure.multiapi.storage.v2016_05_31 import CloudStorageAccount - from azure.cli import core - HAS_LIBS = LooseVersion(core.__version__) >= LooseVersion("2.0.12") + if pkgutil.find_loader('azure.multiapi'): + # use multiapi version if available + from azure.multiapi.storage.v2016_05_31 import CloudStorageAccount + else: + from azure.storage import CloudStorageAccount + HAS_LIBS = True except ImportError: pass # pylint: enable=wrong-import-position,wrong-import-order @@ -152,8 +156,7 @@ def __virtual__(): False, 'The following dependencies are required to use the AzureARM driver: ' 'Microsoft Azure SDK for Python >= 2.0rc5, ' - 'Microsoft Azure Storage SDK for Python >= 0.32, ' - 'Microsoft Azure CLI >= 2.0.12' + 'Microsoft Azure Storage SDK for Python >= 0.32' ) global cache # pylint: disable=global-statement,invalid-name