Skip to content

Add plugin for Azure VM managed identity#106

Merged
jessicamack merged 3 commits into
ansible:develfrom
jessicamack:azure_managed_identity_plugin
May 6, 2025
Merged

Add plugin for Azure VM managed identity#106
jessicamack merged 3 commits into
ansible:develfrom
jessicamack:azure_managed_identity_plugin

Conversation

@jessicamack
Copy link
Copy Markdown
Member

@jessicamack jessicamack commented Apr 14, 2025

This PR adds a plugin that uses Managed Identities for Azure resources on an Azure VM to authenticate and retrieve secrets from an Azure Key Vault. This is similar to how the existing Azure Key Vault plugin works but it does not require Client ID, Client Secret, or Tenant ID. When run in an Azure VM the identity of the VM will be picked up and used as the credential to authenticate to the Key Vault. The only requirements then are the Vault URL, the name of the secret to retrieve, optionally the version of the secret to retrieve, and for the VM itself to be given the correct Key Vault Administrator role.

Comment thread src/awx_plugins/credentials/azure_mi.py Outdated
Comment thread .mypy.ini Outdated
Comment thread src/awx_plugins/credentials/azure_mi.py Outdated
Comment thread src/awx_plugins/credentials/azure_mi.py Outdated
Comment thread pyproject.toml Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.45%. Comparing base (778f356) to head (85c96f9).
⚠️ Report is 453 commits behind head on devel.
✅ All tests successful. No failed tests found.

Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
@webknjaz
Copy link
Copy Markdown
Member

Unrelated linkcheck failure: #107

@jessicamack jessicamack force-pushed the azure_managed_identity_plugin branch from 6c40bbe to 001bcb0 Compare April 22, 2025 19:56
@jessicamack jessicamack requested a review from webknjaz April 22, 2025 19:56
Comment thread src/awx_plugins/credentials/azure_kv.py
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Copy link
Copy Markdown
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

Found a few things to delete.

Comment thread docs/conf.py Outdated
Comment thread docs/conf.py Outdated
Comment thread docs/conf.py Outdated
Comment thread tests/azure_kv_test.py Outdated
Comment thread tests/azure_kv_test.py Outdated
Comment thread tests/azure_kv_test.py Outdated
Comment thread tests/azure_kv_test.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
Comment thread src/awx_plugins/credentials/azure_kv.py Outdated
@jessicamack jessicamack force-pushed the azure_managed_identity_plugin branch 11 times, most recently from ed0ce04 to 8d69ceb Compare May 6, 2025 00:53
jessicamack and others added 3 commits May 5, 2025 20:58
It was previously global and now ignore only one import.

Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Now azure_kv should try the original way to authenticate and if all
the fields are not provided it will fallback to attempting to
authenticate using the Managed Identity method. This patch includes
full test coverage for the newly added code.
@jessicamack jessicamack force-pushed the azure_managed_identity_plugin branch from 8d69ceb to 85c96f9 Compare May 6, 2025 00:59
@jessicamack jessicamack added this pull request to the merge queue May 6, 2025
Merged via the queue into ansible:devel with commit f959143 May 6, 2025
37 checks passed
@jessicamack jessicamack deleted the azure_managed_identity_plugin branch May 6, 2025 01:10
Copy link
Copy Markdown

@adrisala adrisala left a comment

Choose a reason for hiding this comment

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

LGTM, no regression observed 🚀

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.

6 participants