.. versionadded:: 2019.2.0

    List all locations for a subscription.

    :param subscription_id: The ID of the subscription to query.

    CLI Example:

    .. code-block:: bash

        salt-call azurearm_resource.subscriptions_list_locations XXXXXXXX

def subscriptions_list_locations(subscription_id=None, **kwargs):
    '''
    .. versionadded:: 2019.2.0

    List all locations for a subscription.

    :param subscription_id: The ID of the subscription to query.

    CLI Example:

    .. code-block:: bash

        salt-call azurearm_resource.subscriptions_list_locations XXXXXXXX

    '''
    result = {}

    if not subscription_id:
        subscription_id = kwargs.get('subscription_id')
    elif not kwargs.get('subscription_id'):
        kwargs['subscription_id'] = subscription_id

    subconn = __utils__['azurearm.get_client']('subscription', **kwargs)
    try:
        locations = __utils__['azurearm.paged_object_to_list'](
            subconn.subscriptions.list_locations(
                subscription_id=kwargs['subscription_id']
            )
        )

        for loc in locations:
            result[loc['name']] = loc
    except CloudError as exc:
        __utils__['azurearm.log_cloud_error']('resource', str(exc), **kwargs)
        result = {'error': str(exc)}

    return result