Why teams issue dynamic Azure service principals from OpenBao
Teams issue dynamic Azure service principals from OpenBao when long-lived client secrets for automation have outlived the projects that created them and nobody can say which workload still uses them. OpenBao's Azure secrets plugin lets a team request an Azure service principal on demand, with role and group assignments defined in OpenBao, and returns its credentials to the caller for a limited period. The need is strongest for CI pipelines, scheduled jobs and internal tools that call Azure APIs, where one static secret is often copied into several places and rarely rotated.
The lease model is what changes the lifecycle. Each issued credential is attached to a lease with a time to live, and OpenBao revokes the underlying access when that lease expires or is revoked early. The project documents this leasing behavior, with automatic revocation and bulk revocation, in its overview of what OpenBao does. A static client secret stays valid until someone rotates it by hand, and the file that holds it rarely records which consumer received it. With a lease, each request produces a separately tracked identity, so revocation and audit can target one consumer. Confirm in the Azure secrets engine documentation for your OpenBao version exactly what happens to the Azure object at expiry and how quickly Azure reflects the removal.
Before adopting this, decide which Azure roles the plugin may assign and at which scopes, whether group assignments fit your tenant layout, and how the account OpenBao uses to create service principals is itself scoped and protected. Also decide what each consuming workload does when its credential expires mid-job. A short pilot with one pipeline, run against a non-production subscription, will show renewal and cleanup behavior before any wider rollout. Record the lease TTLs, the Azure objects created and the expiry results so that the audit trail matches what the platform team expects.
How a request becomes an Azure service principal and a revoked lease
The flow starts with a client authenticating to OpenBao and requesting credentials from an Azure role. OpenBao's Azure secrets plugin then creates the service principal and its role and group assignments in the Microsoft Entra ID tenant and Azure, and returns the credentials with a lease. When the lease ends, OpenBao revokes the principal and its assignments. The trust boundary sits between OpenBao and the Azure tenant, so confirm which identity OpenBao uses to make those changes and what permissions it holds.
Azure service principal issuance and revocation through the OpenBao lease lifecycle.
Azure secrets plugin role options and when each fits
This table compares the configuration choices an OpenBao Azure secrets role exposes, from how permissions are attached to how long each service principal lives. Read each row as a decision: find the option that matches the workload, then check the risk column before you publish the role. Confirm exact field names against the current OpenBao Azure secrets documentation before you write any role.
| Option | When it fits | Risk it carries |
|---|---|---|
| Direct role assignments | Workloads that need a fixed set of Azure RBAC roles on a known resource, such as a CI job that deploys to one resource group. | Each generated principal gets the listed roles directly, so a broad role definition multiplies quickly across every lease. |
| Group membership | Teams that already manage access through Microsoft Entra ID groups and want generated principals to inherit the same access as human users. | Access depends on group contents outside OpenBao, so a group change can widen access without any change to the OpenBao role. |
| Narrow scope (resource group or resource) | Short-lived automation that touches one application, database or storage account and never needs to see anything else. | Scope that is too narrow can break jobs that need a second resource, which tempts teams to widen the role instead of splitting it. |
| Broad scope (subscription or management group) | Platform or landing-zone tooling that must work across many resources, where per-resource roles would be impractical to maintain. | A leaked lease exposes everything in that scope, so broad scope needs tighter lease TTLs, stronger auth on the role and regular review. |
| Short lease TTL | Batch jobs, pipelines and one-off tasks that finish within a known window and should lose access when they end. | Clients that renew too late or not at all will fail mid-run, so the TTL must be tested against real job duration. |
| Longer lease TTL with a maximum TTL | Long-running services that must keep a stable principal for a bounded period before a forced rotation. | A longer window keeps credentials valid for longer if they are copied out of a process, and the maximum TTL caps renewal but not the initial window. |
| Custom versus built-in role definitions | Built-in roles when they match the need exactly, and custom role definitions when the permissions must be limited to specific actions. | Custom definitions need ongoing maintenance as Azure adds actions, and built-in roles often grant more than the workload uses. |
Setting up the Azure secrets engine and the first role
This sequence connects OpenBao to one Azure tenant and subscription, then defines a role that issues service principals with the Azure role and group assignments you choose. It ends with a test lease that you confirm in Azure and then revoke to confirm that the principal is removed.
Enable the Azure secrets engine
An OpenBao operator with administrative policy enables the engine at a dedicated path with
bao secrets enable azure, or at a custom path if the team wants separate mounts per tenant or environment. Confirm the plugin is available in your build, since the Azure engine may be distributed separately from the core binary. Check that the mount appears in the output ofbao secrets listwith the expected path and type before continuing.Create the Azure identity OpenBao uses
A cloud administrator creates a dedicated application registration and service principal in Microsoft Entra ID for OpenBao to use when it creates and deletes other principals. Keep it separate from any workload identity, and store its client secret in a controlled location rather than in shell history or a shared file. Confirm the exact client secret handling and certificate options supported by the plugin version you run. Check that the identity signs in successfully before granting it any further permissions.
Grant the identity scoped management permissions
The cloud administrator grants the OpenBao identity the directory permissions needed to create and delete service principals in Entra ID, and the role-assignment permission at the scopes where roles will be issued. Limit both to the management group, subscription or resource groups the team actually uses, and avoid broad owner-level grants at the tenant root. Confirm the required Microsoft Graph and Azure RBAC permissions against the Azure secrets plugin documentation for your OpenBao version. Check the grants by listing the identity's role assignments in the Azure portal or with the Azure CLI.
Configure the engine for your tenant and subscription
The operator writes the target tenant, subscription and the OpenBao identity's credentials into the engine's configuration, using keys such as
tenant_id,subscription_id,client_idandclient_secret(confirm the current key names in the plugin reference). Supply the secret from a file or environment variable where possible so it is not left in a command log. Read the configuration back to confirm the tenant and subscription values are correct, and keep the secret field masked in the output. Done means the configuration saves without error.Define the first role with Azure assignments
The operator creates a role with
bao writethat lists the Azure role assignments and, where used, Entra ID group memberships each generated principal should receive, along with the scope for each assignment. Start with one narrow role for a single workload or team so the pattern is easy to review. Confirm the role definition and its TTL settings in the plugin reference, since the exact field names depend on the version. Read the role back and check that the assignments and scopes match the approved design.Issue a test lease and confirm the principal
A tester requests credentials from the role path, for example with
bao read azure/creds/<role>, and records the lease ID and the returned principal's application or client ID. Confirm in Entra ID that the service principal exists and that the expected role assignments and group memberships are present at the intended scope. Also runbao list sys/leases/lookup/azure/creds/<role>to confirm OpenBao is tracking the lease. Done means the principal, its assignments and the lease all match the role definition.Revoke the lease and confirm cleanup
The tester revokes the lease with
bao lease revoke <lease_id>and then checks that OpenBao no longer lists it. In Entra ID, confirm that the generated service principal and its role assignments have been removed, allowing for directory propagation time. If the principal remains after revocation, stop and review the OpenBao identity's permissions and the engine's logs before any production role is issued. Record the result as the acceptance test for this role.
Protecting the root Azure identity and the issued credentials
OpenBao creates Azure service principals with an identity that holds permission to create them, so that identity and every credential it issues become the security boundary. The cards below cover the scope of the root identity, who can read issued secrets, how issuance and revocation are logged, and what happens when Azure calls fail during cleanup.
Scope the root identity narrowly
The identity OpenBao uses to create service principals can grant roles, so its assignment scope defines how much damage a leaked configuration secret can do. Limit it to the subscriptions, resource groups and role definitions the dynamic roles actually need, and avoid giving it owner rights at the tenant or management group level. Ask the Azure team to confirm which directory and Microsoft Graph permissions the plugin requires in your tenant before you grant them.
OpenBao auth docsProtect the root credential in OpenBao
The client secret or certificate that OpenBao uses to reach Azure is stored in its configuration path, so anyone who can read that path can act as the root identity. Restrict read access on the configuration endpoint to a small admin policy, and rotate the root credential on a schedule your security team sets. Keep it out of Git, CI variables and shared runbooks.
Limit who can read issued secrets
Each generated client secret is returned to whoever requested the role, so the read path is the main exposure for issued credentials. Bind each role to a named consumer through policies, and deny broad read access to the credential path for operators who only need to manage roles. Ask who can call the credentials endpoint for each role and document the answer.
Audit issuance and revocation
Enable an audit device so every credential request, issuance and lease revocation is recorded with the requesting identity and the role used. Send those logs to a store your security team monitors, and alert on unusual request volume or requests from unexpected entities. Confirm that audit logs capture the lease identifier, because that is what links a principal in Azure back to a request.
OpenBao namespacesPlan for failed Azure revocations
When lease expiry triggers a deletion and the Azure call fails, the service principal can outlive its lease, which leaves a live credential in your tenant. Test a revocation against a non-production tenant, watch for leases that remain after expiry, and define how operators retry or remove stranded principals manually. Confirm the retry behavior with the vendor or in your own test environment before relying on it.
How lease expiry removes service principals and assignments
Lease expiry is the point where cleanup must be verified, not assumed. OpenBao attaches a time-to-live (TTL) to each lease it issues for an Azure service principal. While the consumer renews the lease, the principal stays valid. When renewal stops or the maximum lease period is reached, OpenBao revokes the lease and calls the Azure secrets plugin to remove what it created. Operators can also revoke a single lease early, or revoke a set of leases in bulk, which is the first response to a suspected leak. OpenBao documents leasing with automatic revocation and bulk revocation in What is OpenBao. Before go-live, confirm the TTL and maximum TTL that each Azure role uses, and decide who may run manual revocation.
What happens in Azure depends on the plugin's revocation logic, so confirm the exact objects it deletes in the plugin documentation for your OpenBao release. Ask which of these are removed on revocation: the role assignments, any group memberships the plugin added, the service principal, and the app registration or credentials behind it. Also ask whether access stops immediately or only after Azure propagates the change, since that window determines how long a revoked identity can still act. Test this in a non-production tenant with a short TTL. Confirm that a revoked principal can no longer sign in, and check the Microsoft Entra sign-in and audit logs to confirm the removal events appear as expected.
If an Azure API call fails during revocation, for example because of throttling, a network fault, or because the identity OpenBao uses to call Azure lost a permission, the Azure objects can outlive their lease. These orphaned service principals and role assignments keep working with no owner in OpenBao. Plan for this before production. Alert on failed revocations in OpenBao logs and audit output. Run a scheduled reconciliation that compares Entra objects carrying the plugin's naming pattern or tags against active leases, and flag any that have no lease. Write a manual cleanup runbook, and rehearse it by revoking a lease while the OpenBao Azure permissions are deliberately withheld in a lab tenant.
Limits to confirm in your Azure tenant before you build
Dynamic Azure service principals depend on permissions and limits that live in your Entra ID tenant and Azure subscriptions, not in OpenBao. Confirm each item below against the OpenBao docs and Microsoft documentation before you write the plugin configuration or design role assignments.
Entra ID permissions for the OpenBao identity
The identity OpenBao uses to create and delete service principals needs directory permissions that Microsoft documents for application and service principal management. Confirm which Entra ID roles or Graph permissions are required for creating apps, service principals and group membership, and whether admin consent is needed. Check whether your organization allows that identity to manage the directory objects it will create. Record the exact permissions in your design so an auditor can trace them.
OpenBao auth docsTenant and subscription limits
Entra ID and Azure both enforce object and assignment quotas that can stop issuance before OpenBao reports an error. Confirm the maximum number of applications, service principals, and role assignments per subscription and tenant in Microsoft documentation, and compare them with your expected lease count. Ask your Azure administrators whether quotas have been raised for this workload. Include quota monitoring in your operations plan.
Propagation delay for role assignments
Azure role assignments and new service principals can take time to become effective across the platform, so a credential returned by OpenBao may not yet have access. Confirm the documented propagation behavior in Microsoft documentation and decide how your workloads retry during that window. Test the first request after creation rather than assuming immediate access. Document the delay you observe in your own tenant.
Supported Azure scopes
Role assignments can be made at management group, subscription, resource group and resource scope, and each choice changes blast radius. Confirm which scopes the OpenBao Azure plugin accepts for role and group assignments in the version you deploy. Verify that group-based assignments behave as your access model expects. Keep scopes as narrow as your workloads allow.
Version compatibility with your OpenBao release
Plugin behavior, configuration keys and supported options can change between OpenBao releases, and the Azure plugin is not guaranteed to match your core binary. Confirm the plugin version and its documented requirements against the OpenBao release you deploy, using the releases page and plugin documentation. Pin versions in your deployment and retest after each upgrade. Check whether lease cleanup behavior differs between the versions you consider.
OpenBao releasesQuestions teams ask before issuing Azure credentials from OpenBao
What drives the cost of setting up Azure service principals in OpenBao?
The cost follows the written scope, and most of it is skilled time spent on Azure and OpenBao configuration, identity design and application changes. The main components are the tenant review, configuration of the Azure secrets plugin, the role and group model, changes to each consuming application, testing of lease expiry and cleanup, and handover. Setup is one-time work. Running the platform, reviewing role changes and applying upgrades recur, whether an internal team or a partner carries them. Cost rises with the number of Azure subscriptions, the number of applications that still use stored client secrets, and how many role assignments must be modeled. Ask for a quote that lists each of these components separately, with who performs each one and what is delivered at each step.
How long does an Azure credentials rollout usually take?
Duration depends less on the OpenBao configuration than on approvals and the number of applications that must change. The factors that most often extend the schedule are the tenant review, change windows for role and group assignments, security sign-off on the identity model, and the order in which applications move off long-lived secrets. A pilot with one non-critical workload usually shows the lease and cleanup behavior before wider rollout. Ask any provider to tie the timeline to named milestones, such as review complete, pilot running and each application cut over, so that delays are visible early and attached to a specific dependency.
What access do we need to give from our Azure tenant?
The work needs an Azure administrator who can create or approve app registrations, assign roles at the chosen scopes, and grant the OpenBao identity the directory permissions that the Azure secrets plugin requires. Confirm the exact permissions against the plugin documentation for your OpenBao version, because they change between releases. Keep the grant as narrow as the design allows, limited to the subscriptions, resource groups or management groups in scope. Agree in writing who holds these rights during the engagement, how they are removed afterward, and which break-glass accounts remain available if OpenBao cannot reach Azure.
How should we design roles and groups before generating principals?
Design the model before the first credential is issued, because every generated service principal inherits its assignments from the roles you define. Decide which Azure roles each OpenBao role may grant, at which scope, and which Microsoft Entra ID groups should own those assignments. Use a naming convention that lets a log entry be traced back to an application and a team. Define who may request each role in OpenBao and how that request is approved. Keep group membership managed in Entra ID rather than duplicated in OpenBao, so access reviews have one place to look. Document the model so the platform team can review it on a schedule.
What changes do applications need to use dynamic Azure credentials?
Applications must stop reading a long-lived client secret from configuration files, environment variables or pipeline variables, and instead obtain credentials from OpenBao when they start or when a lease needs renewal. The usual options are a sidecar or agent that writes credentials to a file, a library call inside the application, or a pipeline step that fetches credentials for one job. Each option must handle expiry, reconnect after a rotation and fail safely when OpenBao is unavailable. Batch jobs and CI pipelines often need the most change, because they assume credentials last for their whole run. Inventory every consumer before scheduling cut-over.
Can our own platform team deliver this without an outside partner?
Yes, a team can deliver this alone if it has administrator rights in the Azure tenant, operating experience with OpenBao, and time to work through identity design and application changes across several owners. The difficulty is seldom the plugin configuration. It is the coordination between Azure administration, security review, and the teams that own each application. A partner adds the most value when the scope is large, when the team lacks Azure or OpenBao depth, or when deadlines are tight. DeployOpen plans and implements engagements under fixed scope, with deliverables and timelines agreed in writing before work starts, so the decision can be made against a defined list of work.
What happens to Azure service principals when their leases expire?
When a lease expires or is revoked, OpenBao asks the Azure secrets plugin to remove the service principal and its assignments, so access ends without a manual cleanup step. Confirm this behavior for your OpenBao version in the plugin documentation, and test it in a non-production tenant before relying on it. Plan for failure cases: an OpenBao outage during revocation, a revocation that Azure rejects, or a principal created outside OpenBao. Monitor lease counts and revocation errors, and run a periodic search for principals that match your naming convention but have no active lease. Ask the provider how they test these failure paths.
How does ongoing support fit after the Azure integration goes live?
After go-live, the recurring work is operating the OpenBao cluster, reviewing role and group changes, applying OpenBao and plugin upgrades, checking revocation and error metrics, and updating applications when Azure requirements change. Your team can own all of this, or a partner can cover part of it under a retainer. Retainers cover ongoing support, upgrades and continuous testing, and the scope of each one should be written down, including response expectations and who approves changes to role models. Ask which of these tasks stay with your team regardless of the arrangement, so ownership is clear from the first day.
What changes for application teams and the security team
The main operating change is that application owners stop filing tickets for a shared Azure login and start requesting a role-scoped service principal that OpenBao issues on demand. Each request should name the application, the environment and the Azure role and group assignments the workload needs, and the security team should approve that mapping once rather than each issuance. Because the secrets engine creates the principal from a role definition, the requester's choice is limited to the roles that the security team has already defined. Teams should confirm with their own Azure administrators which Entra ID and Azure RBAC permissions the OpenBao identity needs to create and delete principals, since that permission set is the most sensitive part of the setup and is not something the secrets engine decides for you.
The security team's work shifts from reviewing individual credentials to reviewing role definitions and their lifetimes. A reviewer should check which role and group assignments each OpenBao role grants, what the default and maximum lease TTLs are, and whether the scope is a subscription, resource group or single resource. Changes to these definitions should go through the same change process as other access policy, and the audit log should be checked to confirm that every issuance and revocation is recorded against the token or entity that asked for it. Manual steps remain: approving new role definitions, deciding which groups a team may request, and investigating any lease that fails to revoke. Teams should also ask their auditors which evidence they expect for issuance history, since OpenBao supplies the logs but not the audit conclusion.
How DeployOpen scopes and delivers Azure credential issuance with OpenBao
DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside your own infrastructure, including OpenBao. For dynamic Azure service principals, the work starts with a written scope covering your tenant, roles, groups and lease rules, then moves through a tested build and a handover your team can operate.
How we scope
- Inventory which Azure subscriptions, resource groups and roles the Azure secrets engine may assign, and who may request them.
- Define lease lifetimes, renewal rules and the cleanup behavior your teams expect when leases expire.
- Agree deliverables, environments and acceptance tests in writing before any work starts, since most engagements are fixed-scope.
How we build
- Configure the Azure secrets plugin with a least-privilege service principal that OpenBao uses to create and remove the dynamic principals.
- Map role and group assignments to OpenBao roles and policies, then test issuance and automatic revocation in a non-production tenant.
- Run security tests on the setup, including credential exposure, over-broad permissions and whether revoked principals lose access as expected.
How we hand over
- Document the configuration, policies, lease settings and the runbook for issuing, renewing and revoking Azure credentials.
- Walk your platform and security teams through the cleanup checks and the logs they should review when a lease fails to revoke.
- Deliver the configuration and documentation into your own repositories so your team owns the deployment after handover.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers when you want DeployOpen to keep the setup current.
- Plan OpenBao version upgrades and retest Azure issuance and revocation after each upgrade or Azure permission change.
- Provide evidence of access controls and credential lifecycle that your compliance team can review. DeployOpen prepares this evidence but does not issue audit reports or certifications.

