Hello Tobias Quadfasel,
Thank you for posting your question in the Microsoft Q&A forum.
To securely access Azure Key Vault from your IoT Edge module, you’ll need to implement one of the following approaches since the IoT Hub’s managed identity isn’t directly available to modules. The recommended method is to leverage the device’s own identity by enabling a managed identity for the IoT Edge device itself (if using Azure IoT Hub with Azure Arc-enabled devices) and granting it Key Vault Secret User access. Alternatively, you can use module-specific authentication by either:
- Deploying a service principal (stored as an environment variable or in a secure module twin property) for Key Vault access.
- Implementing certificate-based authentication (X.509) for the module, tied to Azure AD.
- Using IoT Edge’s Key Store for secrets, synced from Key Vault via the IoT Edge runtime.
For minimal code changes, DefaultAzureCredential can still work if you configure environment variables (AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET) in the module deployment manifest. However, for production, prefer device-level managed identities or certificate-based auth to avoid hardcoded credentials.
If your IoT Edge device runs on an Azure VM, you could also attach the VM’s managed identity to the module. Always ensure Key Vault firewall rules allow access from the module’s IP or trusted services.
Reference
https://dori-uw-1.kuma-moon.com/en-us/azure/key-vault/general/rbac-guide?tabs=azure-cli
https://dori-uw-1.kuma-moon.com/en-us/entra/identity/managed-identities-azure-resources/overview
https://github.com/Azure/iotedge/issues/1300
If the above answer helped, please do not forget to "Accept Answer" as this may help other community members to refer the info if facing a similar issue. Your contribution to the Microsoft Q&A community is highly appreciated.