Skip to content

Conversation

@sirkubax
Copy link

@sirkubax sirkubax commented Mar 2, 2020

huh, that was a tricky one:

- name: Create Vault                                                            
  hosts: localhost                                                              
  connection: local                                                             
  vars:                                                                         
    resource_group_name: testme                                           
    resource_group: "{{ resource_group_name }}"                                 
    vm_name: testvm                                                             
    #location: eastus                                                           
  tasks:     
  - name: Look up secret when ansible host is general VM                        
    vars:                                                                                              
      url: 'https://myVault.vault.azure.net/'                                  
      secretname: 'SecretPassword'                                             
      client_id: 'ServicePrincipalIDHere'                                      
      secret: 'ServicePrinipcalPassHere'                                       
      tenant: 'TenantIDHere'                                                   
    #debug: msg="the value of this secret is {{lookup('azure_keyvault_secret',secret_name,vault_url=url, cliend_id=client_id, secret=secret, tenant_id=tenant)}}"
    debug: msg="the value of this secret is {{lookup('azure_keyvault_secret',secret_name,vault_url=url, client_id=client_id, secret=secret, tenant_id=tenant)}}"

msg": "An unhandled exception occurred while running the lookup plugin 'azure_keyvault_secret'. Error was a <class 'ansible.errors.AnsibleError'>, original message: Invalid credentials provided."

only when you debug it at low level (module code) you can see:

msg": "An unhandled exception occurred while running the lookup plugin 'azure_keyvault_secret'. Error was a <class 'msrest.exceptions.AuthenticationError'>, original message: , AdalError: Get Token request returned http error: 400 and server response: {\"error\":\"invalid_request\",\"error_description\":\"AADSTS900144: The request body must contain the following parameter: 'client_id'.

huh, that was a tricky one:

```msg": "An unhandled exception occurred while running the lookup plugin 'azure_keyvault_secret'. Error was a <class 'ansible.errors.AnsibleError'>, original message: Invalid credentials provided."
```

only when you debug it at low level (module code) you can see:
```
msg": "An unhandled exception occurred while running the lookup plugin 'azure_keyvault_secret'. Error was a <class 'msrest.exceptions.AuthenticationError'>, original message: , AdalError: Get Token request returned http error: 400 and server response: {\"error\":\"invalid_request\",\"error_description\":\"AADSTS900144: The request body must contain the following parameter: 'client_id'.
```
Copy link

@gavinfish gavinfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Fred-sun
Copy link
Collaborator

@sirkubax Thank you for taking the time to contribute to this PR. We will transferred ansible 's azure module related Issue and PR to azure collection (https://github.com/ansible-collections/azure/pulls), can you transfer the Issue to azure collection repo?

@Fred-sun
Copy link
Collaborator

@sirkubax Repeat with PR #352 before, it is recommended to close. Thank you very much!

@Fred-sun
Copy link
Collaborator

@sirkubax Thank you very much for your interest in Ansible. This repo is no longer maintained in this repository and has been migrated to https://github.com/ansible-collections/azure
Please re-submit this PR in the above repository and closed this. Thank you very much!

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

Successfully merging this pull request may close these issues.

5 participants