Having azure.azcollection 2.6.0 installed and using service principle auth but still using azure cli dependency

We are trying to make a azure blob connection using azure.azcollection.azure_rm_storageblob package in ansibel. Below is the ansible playbook.

  • name: Upload file to Azure Blob
    hosts: localhost
    tasks:
    • name: Upload file to Azure Blob
      azure.azcollection.azure_rm_storageblob:
      subscription_id: “{{ lookup(‘env’, ‘azure_subscription_id’) }}”
      client_id: “{{ lookup(‘env’, ‘azure_client_id’) }}”
      secret: “{{ lookup(‘env’, ‘azure_secret’) }}”
      tenant: “{{ lookup(‘env’, ‘azure_tenant’) }}”
      storage_account_name: “nonprodsre}”
      resource_group: “rgsremgmtdev”
      container: “autotron-action”
      blob: “fsdfsfsfd”
      src: “./test.yml”
      state: present
      and exported export azure_tenant=“xxxx”
      export azure_subscription_id=“xxxxxx”
      export azure_client_id=“xxxxxxx”
      export azure_secret=“xxxxxxx”

autotron@c08393297018:~$ ansible-galaxy collection list

/usr/local/lib/python3.9/site-packages/ansible_collections

Collection Version


amazon.aws 6.5.0
ansible.netcommon 5.2.0
ansible.posix 1.5.4
ansible.utils 2.11.0
ansible.windows 1.14.0
arista.eos 6.1.2
awx.awx 22.7.0
azure.azcollection 2.6.0

autotron@c08393297018:~$ ansible-playbook test.yml

[WARNING]: No inventory was parsed, only implicit localhost is available

[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’

PLAY [Upload file to Azure Blob] **********************************************************************************************************************************************************

TASK [Gathering Facts] ********************************************************************************************************************************************************************

ok: [localhost]

TASK [Upload file to Azure Blob] **********************************************************************************************************************************************************

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘azure.cli’

fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “Failed to import the required Python library (ansible[azure] (azure >= 2.0.0)) on c08393297018’s Python /usr/local/bin/python. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter”}

AS PER DOCUMENTATION if using azure.azcollection 2.6.0. IT should not use azure cli to authenticate if passing env var for service priciple authentiocayion.