-
Notifications
You must be signed in to change notification settings - Fork 335
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
azure_rm_keyvaultsecret uses wrong credentials #803
Comments
I am experiencing this error as well. The specified credentials are ignored if running in an environment where managed identities are available for azure_rm_keyvaultsecret. I believe the error was introduced in 199c7ee - if auth_source != 'msi', AzureRMKeyVaultSecret still attempts to retrieve credentials from MSI (see the else block - plugins/modules/azure_rm_keyvaultsecret.py:210). Which will succeed if running in Azure (or AKS, in my case), but will return the credentials assigned to the current VM, not the credentials specified in the playbook. |
@SSPJ The reason for this problem is that there are special permission requirements for keystores that require adding access policies and role assignments to the keystores used (the application you are currently using). You can refer to the link below. |
@Fred-sun I can't be absolutely certain that @SSPJ 's issue is the same as mine, although the error looks very similar. I can successfully run this task locally: azure_rm_keyvaultsecret:
secret_name: "{{ secret_name }}"
secret_value: "{{ password }}"
keyvault_uri: "{{ keyvault_uri }}"
subscription_id: "{{ subscription_id }}"
tenant: "{{ tenant_id }}"
client_id: "{{ client_id }}"
secret: "{{ secret }}" However, if I run that that task using the same arguments on an AKS pod, it fails. The error reported by Azure is:
But XYZ is not the client_id I specified in my playbook. (@SSPJ 's error is the same, which is why I believe we have the same issue). My The bug here:
The logic now is:
2 above seems wrong to me (and is not what is documented). As written, azure_rm_keyvaultsecret will never use the specified credentials when run on an Azure VM. Thank you! |
I have just confirmed that I can successfully run the azure_rm_keyvaultsecret task above if I downgrade to 1.11.0 ( |
@Fred-sun Thank you for the help troubleshoot, but I believe @markscottwright is correct that this is a bug in the module. I do not want to give my virtual machine permission to set secrets in my key vaults. That is a security risk. I want |
Yeah! I am sure! |
This did not work:
This also did not work:
This did work:
This is the error.
Z1xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
is not the ID of my SP nor my own ID. It is the appID of the virtual machine on which the playbook is running.The text was updated successfully, but these errors were encountered: