Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when using azure_rm_keyvaultsecret_info with cli #547

Closed
andrejbrummelhuis opened this issue May 26, 2021 · 1 comment
Closed

Issue when using azure_rm_keyvaultsecret_info with cli #547

andrejbrummelhuis opened this issue May 26, 2021 · 1 comment

Comments

@andrejbrummelhuis
Copy link

andrejbrummelhuis commented May 26, 2021

SUMMARY

I get the following error when trying to retrieve a secret from my azure key vault.
I am definitely logged in with the cli since retrieving the secret manually using az cli commands does work.

fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Your credentials class does not support session injection. Performance will not be at the maximum.\nTraceback (most recent call last):\n File \"/Users/andrejtenbrummelhuis/.ansible/tmp/ansible-tmp-1622043319.991893-1226-83362253828378/AnsiballZ_azure_rm_keyvaultsecret_info.py\", line 100, in <module>\n _ansiballz_main()\n File \"/Users/andrejtenbrummelhuis/.ansible/tmp/ansible-tmp-1622043319.991893-1226-83362253828378/AnsiballZ_azure_rm_keyvaultsecret_info.py\", line 92, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/Users/andrejtenbrummelhuis/.ansible/tmp/ansible-tmp-1622043319.991893-1226-83362253828378/AnsiballZ_azure_rm_keyvaultsecret_info.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.azure.azcollection.plugins.modules.azure_rm_keyvaultsecret_info', init_globals=dict(_module_fqn='ansible_collections.azure.azcollection.plugins.modules.azure_rm_keyvaultsecret_info', _modlib_path=modlib_path),\n File \"/usr/local/Cellar/[email protected]/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/local/Cellar/[email protected]/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/local/Cellar/[email protected]/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_lm2l3lzi/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_keyvaultsecret_info.py\", line 430, in <module>\n File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_lm2l3lzi/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_keyvaultsecret_info.py\", line 426, in main\n File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_lm2l3lzi/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_keyvaultsecret_info.py\", line 236, in __init__\n File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_lm2l3lzi/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py\", line 456, in __init__\n File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_lm2l3lzi/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_keyvaultsecret_info.py\", line 262, in exec_module\n File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_lm2l3lzi/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_keyvaultsecret_info.py\", line 368, in list_secrets\n File \"/usr/local/lib/python3.8/site-packages/msrest/paging.py\", line 143, in __next__\n self.advance_page()\n File \"/usr/local/lib/python3.8/site-packages/msrest/paging.py\", line 129, in advance_page\n self._response = self._get_next(self.next_link)\n File \"/usr/local/lib/python3.8/site-packages/azure/keyvault/key_vault_client.py\", line 1867, in internal_paging\n response = self._client.send(\n File \"/usr/local/lib/python3.8/site-packages/msrest/service_client.py\", line 336, in send\n pipeline_response = self.config.pipeline.run(request, **kwargs)\n File \"/usr/local/lib/python3.8/site-packages/msrest/pipeline/__init__.py\", line 197, in run\n return first_node.send(pipeline_request, **kwargs) # type: ignore\n File \"/usr/local/lib/python3.8/site-packages/msrest/pipeline/__init__.py\", line 150, in send\n response = self.next.send(request, **kwargs)\n File \"/usr/local/lib/python3.8/site-packages/msrest/pipeline/requests.py\", line 72, in send\n return self.next.send(request, **kwargs)\n File \"/usr/local/lib/python3.8/site-packages/msrest/pipeline/requests.py\", line 137, in send\n return self.next.send(request, **kwargs)\n File \"/usr/local/lib/python3.8/site-packages/msrest/pipeline/__init__.py\", line 150, in send\n response = self.next.send(request, **kwargs)\n File \"/usr/local/lib/python3.8/site-packages/msrest/pipeline/requests.py\", line 193, in send\n self.driver.send(request.http_request, **kwargs)\n File \"/usr/local/lib/python3.8/site-packages/msrest/universal_http/requests.py\", line 333, in send\n return super(RequestsHTTPSender, self).send(request, **requests_kwargs)\n File \"/usr/local/lib/python3.8/site-packages/msrest/universal_http/requests.py\", line 139, in send\n response = session.request(\n File \"/usr/local/lib/python3.8/site-packages/requests/sessions.py\", line 542, in request\n resp = self.send(prep, **send_kwargs)\n File \"/usr/local/lib/python3.8/site-packages/requests/sessions.py\", line 662, in send\n r = dispatch_hook('response', hooks, r, **kwargs)\n File \"/usr/local/lib/python3.8/site-packages/requests/hooks.py\", line 31, in dispatch_hook\n _hook_data = hook(hook_data, **kwargs)\n File \"/usr/local/lib/python3.8/site-packages/azure/keyvault/custom/key_vault_authentication.py\", line 146, in _handle_401\n security = self._get_message_security(prep, challenge)\n File \"/usr/local/lib/python3.8/site-packages/azure/keyvault/custom/key_vault_authentication.py\", line 169, in _get_message_security\n token = AccessToken(*self._callback(challenge.get_authorization_server(),\n File \"/usr/local/lib/python3.8/site-packages/azure/keyvault/custom/key_vault_authentication.py\", line 60, in _auth_callback_compat\n return self._user_callback(server, resource, scope) \\\n File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_lm2l3lzi/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_keyvaultsecret_info.py\", line 279, in auth_callback\nKeyError: 'client_id'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

ISSUE TYPE
  • Bug Report
COMPONENT NAME

azure_rm_keyvaultsecret_info

ANSIBLE VERSION

ansible [core 2.11.1]
config file = Nonens
executable location = /usr/local/bin/ansible
python version = 3.8.10 (default, May 4 2021, 03:04:19) [Clang 11.0.0 (clang-1100.0.33.17)]
jinja version = 3.0.1
libyaml = True

CONFIGURATION

OS / ENVIRONMENT

macOS Mojave 10.14.6

STEPS TO REPRODUCE
- hosts: localhost
  gather_facts: false
  tasks:
    - name: Get secrets
      azure.azcollection.azure_rm_keyvaultsecret_info:
        vault_uri: "https://sharedkvtf.vault.azure.net"
EXPECTED RESULTS
ACTUAL RESULTS
 ansible-playbook test-random-playbook.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 [localhost] ********************************************************************************************************************************************************

TASK [Get secret] *******************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Your credentials class does not support session injection. Performance will not be at the maximum.\nTraceback (most recent call last):\n  File \"/Users/andrejtenbrummelhuis/.ansible/tmp/ansible-tmp-1622043888.942786-3203-16288230444443/AnsiballZ_azure_rm_keyvaultsecret_info.py\", line 100, in <module>\n    _ansiballz_main()\n  File \"/Users/andrejtenbrummelhuis/.ansible/tmp/ansible-tmp-1622043888.942786-3203-16288230444443/AnsiballZ_azure_rm_keyvaultsecret_info.py\", line 92, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/Users/andrejtenbrummelhuis/.ansible/tmp/ansible-tmp-1622043888.942786-3203-16288230444443/AnsiballZ_azure_rm_keyvaultsecret_info.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.azure.azcollection.plugins.modules.azure_rm_keyvaultsecret_info', init_globals=dict(_module_fqn='ansible_collections.azure.azcollection.plugins.modules.azure_rm_keyvaultsecret_info', _modlib_path=modlib_path),\n  File \"/usr/local/Cellar/[email protected]/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py\", line 207, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/local/Cellar/[email protected]/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/local/Cellar/[email protected]/3.8.10/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_q6ob3pv6/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_keyvaultsecret_info.py\", line 430, in <module>\n  File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_q6ob3pv6/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_keyvaultsecret_info.py\", line 426, in main\n  File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_q6ob3pv6/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_keyvaultsecret_info.py\", line 236, in __init__\n  File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_q6ob3pv6/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py\", line 456, in __init__\n  File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_q6ob3pv6/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_keyvaultsecret_info.py\", line 262, in exec_module\n  File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_q6ob3pv6/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_keyvaultsecret_info.py\", line 368, in list_secrets\n  File \"/usr/local/lib/python3.8/site-packages/msrest/paging.py\", line 143, in __next__\n    self.advance_page()\n  File \"/usr/local/lib/python3.8/site-packages/msrest/paging.py\", line 129, in advance_page\n    self._response = self._get_next(self.next_link)\n  File \"/usr/local/lib/python3.8/site-packages/azure/keyvault/key_vault_client.py\", line 1867, in internal_paging\n    response = self._client.send(\n  File \"/usr/local/lib/python3.8/site-packages/msrest/service_client.py\", line 336, in send\n    pipeline_response = self.config.pipeline.run(request, **kwargs)\n  File \"/usr/local/lib/python3.8/site-packages/msrest/pipeline/__init__.py\", line 197, in run\n    return first_node.send(pipeline_request, **kwargs)  # type: ignore\n  File \"/usr/local/lib/python3.8/site-packages/msrest/pipeline/__init__.py\", line 150, in send\n    response = self.next.send(request, **kwargs)\n  File \"/usr/local/lib/python3.8/site-packages/msrest/pipeline/requests.py\", line 72, in send\n    return self.next.send(request, **kwargs)\n  File \"/usr/local/lib/python3.8/site-packages/msrest/pipeline/requests.py\", line 137, in send\n    return self.next.send(request, **kwargs)\n  File \"/usr/local/lib/python3.8/site-packages/msrest/pipeline/__init__.py\", line 150, in send\n    response = self.next.send(request, **kwargs)\n  File \"/usr/local/lib/python3.8/site-packages/msrest/pipeline/requests.py\", line 193, in send\n    self.driver.send(request.http_request, **kwargs)\n  File \"/usr/local/lib/python3.8/site-packages/msrest/universal_http/requests.py\", line 333, in send\n    return super(RequestsHTTPSender, self).send(request, **requests_kwargs)\n  File \"/usr/local/lib/python3.8/site-packages/msrest/universal_http/requests.py\", line 139, in send\n    response = session.request(\n  File \"/usr/local/lib/python3.8/site-packages/requests/sessions.py\", line 542, in request\n    resp = self.send(prep, **send_kwargs)\n  File \"/usr/local/lib/python3.8/site-packages/requests/sessions.py\", line 662, in send\n    r = dispatch_hook('response', hooks, r, **kwargs)\n  File \"/usr/local/lib/python3.8/site-packages/requests/hooks.py\", line 31, in dispatch_hook\n    _hook_data = hook(hook_data, **kwargs)\n  File \"/usr/local/lib/python3.8/site-packages/azure/keyvault/custom/key_vault_authentication.py\", line 146, in _handle_401\n    security = self._get_message_security(prep, challenge)\n  File \"/usr/local/lib/python3.8/site-packages/azure/keyvault/custom/key_vault_authentication.py\", line 169, in _get_message_security\n    token = AccessToken(*self._callback(challenge.get_authorization_server(),\n  File \"/usr/local/lib/python3.8/site-packages/azure/keyvault/custom/key_vault_authentication.py\", line 60, in _auth_callback_compat\n    return self._user_callback(server, resource, scope) \\\n  File \"/var/folders/wm/pq5mf3gd48lg0rkkq12fv8j80000gn/T/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload_q6ob3pv6/ansible_azure.azcollection.azure_rm_keyvaultsecret_info_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_keyvaultsecret_info.py\", line 279, in auth_callback\nKeyError: 'client_id'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

@andrejbrummelhuis
Copy link
Author

Just found an already related issue: #134

Guess this can be closed/deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant