Having issues with Dynamic SP creation consistently. Creating new secrets for exisiting service principals works as expected but the dynamic one fails.
Vault Version:
Version Installation Time Build Date
------- ----------------- ----------
1.21.1 2025-12-11T09:32:22Z 2025-11-18T13:04:32Z
Azure plugin version:
azure secret v0.23.0+builtin
Reproduction Steps:
Following guide here
- Enable Azure secrets engine
- Configure Azure engine
- Provide permissions as needed to the SP, mainly: Application.ReadWrite.All and GroupMember.ReadWrite.All. Provide User Access Administrator role on the subscription to allow role assignment access to the SP.
- Create a dynamic role using:
vault write azure/roles/edu-app ttl=1h azure_roles=-<<EOF
[
{
"role_name": "Contributor",
"scope": "/subscriptions/$SUBSCRIPTION_ID/resourceGroups/vault-education"
}
]
EOF
- Read using
vault read azure/creds/edu-app
Output is:
Error reading azure/creds/edu-app: Error making API request.
URL: GET http://127.0.0.1:8200/v1/azure/creds/edu-app
Code: 500. Errors:
* 1 error occurred:
* error creating service principal: 2 errors occurred:
* Resource '3e600671-c682-43fd-95a5-85bb804af996' does not exist or one of its queried reference-property objects are not present.
* Resource '3e600671-c682-43fd-95a5-85bb804af996' does not exist or one of its queried reference-property objects are not present.
Whereas the Service Principal/Enterprise Application actually exists with that ID.
Some logs that might be helpful from azure activity logs:
Event initiated by development-vault-azure-engine
Error code PrincipalNotFound
Message Principal 3e600671c68243fd95a585bb804af996 does not exist in the directory xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. Check that you have the correct principal ID. If you are creating this principal and then immediately assigning a role, this error might be related to a replication delay. In this case, set the role assignment principalType property to a value, such as ServicePrincipal, User, or Group. See https://aka.ms/docs-principaltype
Might be related to - microsoftgraph/msgraph-bicep-types#193. The solution there is to wait for a bit for replication.
Having issues with Dynamic SP creation consistently. Creating new secrets for exisiting service principals works as expected but the dynamic one fails.
Vault Version:
Reproduction Steps:
Following guide here
Output is:
Whereas the Service Principal/Enterprise Application actually exists with that ID.
Some logs that might be helpful from azure activity logs:
Might be related to - microsoftgraph/msgraph-bicep-types#193. The solution there is to wait for a bit for replication.