Azure / azure_preview_modules

Azure preview modules for Ansible
https://galaxy.ansible.com/azure/azure_preview_modules
43 stars 49 forks source link

Fix example #368

Open sirkubax opened 4 years ago

sirkubax commented 4 years ago

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'.
Fred-sun commented 4 years ago

@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 commented 4 years ago

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

Fred-sun commented 4 years ago

@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!