0

I am querying the data factories within a resource group but I couldn't make it work. I can query it through the rest api but not through azure_rm_resource_info ansible module:

- name: Check if Data Factory ({{ az_datafactory_name }}) already exists
azure.azcollection.azure_rm_resource_info:
  auth_source: auto
  client_id: "{{ az_client_id }}"
  secret: "{{ az_secret }}"
  tenant: "{{ az_tenant_id }}"
  subscription_id: "{{ az_subscription_id }}"
  url: "https://management.azure.com/subscriptions/{{ az_subscription_id }}/resourceGroups/{{ az_resource_group_name }}/providers/Microsoft.DataFactory/factories?api-version=2018-06-01"
register: az_datafactory

Output: fatal: [localhost]: FAILED! => {"changed": false, "msg": "Couldn't find api version for Microsoft.DataFactory/factories?api-version=2018-06-01"}

  • 1
    What happens if you do not specify an API version? I believe that the default behavior is for the module to try and lookup the latest version if it is not specified. That said, I am only aware of two valid API versions for Microsoft.DataFactory/factories: 2017-09-01-preview and 2018-06-01. So, it might not make a difference. – MrVitaminP Jun 17 '22 at 17:23
  • Seem to work fine without the api version. Thanks! – Rustan Rodriguez Jun 20 '22 at 12:12

1 Answers1

0

Thanks for the tip of @MrVitaminP. Changing the url seems to solve my problem:

url: "https://management.azure.com/subscriptions/{{ az_subscription_id }}/resourceGroups/{{ az_resource_group_name }}/providers/Microsoft.DataFactory/factories"