A machine identity should have a short life and a narrow job
At two in the morning, a small job transfers newly approved photographs from a regional museum's catalog to a public exhibit service. Its purpose is narrow: publish files from one collection and record which exhibit entries were updated. During a routine access review, the security team discovers that the job can also delete private collections, change cloud billing settings, and grant permissions to other users. Nothing has been stolen, and the job has not made those changes. The discovery still changes how the team should think about the next release.
The automation works because it carries a machine identity. That identity allows a service to act without an employee signing in for every operation. The first mistake would be to call the identity secure merely because no human password appears in the script. The important question is what the external service believes about this machine, why it believes that claim, which resources it will allow the machine to affect, and how the organization can withdraw that authority when the job ends.
Imagine the museum has a public exhibit application, a private research archive, and a billing account managed by different teams. A transfer job has a legitimate reason to upload approved image files and read a small amount of exhibit metadata. It has no reason to modify the private archive or authorize a new administrator. Giving it broad account access converts an error in a modest publishing workflow into a possible organization-wide incident. No malicious actor is required. An incorrect collection identifier or faulty cleanup routine could make the job use permissions it never needed.
For a separate review exercise, the Bare Metal Cyber AutoOps+ Study Guide can help trace the museum job from the workload that starts it to the protected resource it modifies. Describe who issues its identity, what the external service must verify, which specific operations the job needs, and who would investigate an unexpected call. Those answers expose gaps that a label such as service account or administrator cannot settle.
A service account, service principal, cloud role, and workload identity are names used in different systems for related concepts. They are not interchangeable objects across every provider, but they address the same need: assign recognizable authority to a piece of software. A machine identity needs an owner and purpose, just as a physical access badge does. Its record should explain which workload uses it, in which environment, which resource boundary it serves, and who can request changes to its privileges.
Authentication and authorization happen at different stages. Authentication establishes that the service presenting a credential is the identity it claims to be. Authorization determines whether that identity may perform an action on a particular resource under the current conditions. An expired credential can prevent authentication. A valid credential with a restricted role can authenticate successfully and still be denied permission to delete a collection. Troubleshooting gets dangerous when a team responds to the second result by granting every permission available.
A traditional approach gives the job a stored application secret or access key. That may be supported, and some external services still require it, but the secret has to be protected wherever the job runs. Copying the same secret into a test project, development laptop, and production runner creates several independent exposure points. If the key leaks, a stranger may be able to use it without running the museum's workflow. Rotation and monitoring become obligations rather than optional improvements.
Modern identity systems often let a hosted workload obtain temporary credentials without embedding a long-lived cloud secret in its deployment definition. A cloud-hosted service may use a managed identity supplied by its platform. A job running in an external continuous integration service may use workload identity federation. In both cases, the goal is to establish a trusted identity for the software and obtain limited authority at the time it needs to act. These are supported patterns, not promises that every provider or legacy application can use them.
Federation introduces a useful separation. The automation platform first asserts what workload is running. An external identity service verifies that assertion under a previously configured trust relationship. If the claim satisfies the rules, the external service issues an access credential suitable for the protected resource. That new credential is not the same object as the original assertion. One proves facts about the running job; the other grants access to the service under the agreed policy.
The trust relationship should recognize more than the name of the automation platform. A platform may run thousands of unrelated repositories and jobs. Knowing that a token came from the platform is not enough to say it came from the museum's authorized publication workflow. The trust conditions can narrow the source to the intended repository, deployment environment, branch, or other claims the identity provider and cloud service support. The exact claims and permitted formats differ across platforms and may change over time, so engineers need provider documentation rather than a copied trust example from an unrelated organization.
Three ideas help reason through that trust. The issuer is the identity system that created the assertion. The subject identifies the workload or principal described by it. The audience indicates the service for which the assertion was intended. A receiver should validate the signature, relevant time limits, and the applicable identity and trust conditions before exchanging the assertion for access. A genuine token from a known issuer can still be wrong for this job if its subject or audience does not satisfy the expected relationship.
Suppose the museum allows every build in its organization to assume the exhibit publishing role. An experimental student catalog project now has a path to the same publishing authority as the production release. The permissions attached to the role may be narrow, but the group of workloads allowed to acquire it is much too broad. The team should restrict both sides of the design: which workload may assume the role and what the resulting role is permitted to do. A correctly scoped permission policy cannot compensate for a trust rule that recognizes the wrong jobs.
Now imagine the opposite failure. The job comes from the authorized production workflow, but the role grants deletion across all museum collections. The trust boundary may be sound while the permission boundary is not. The team should examine the operations actually required by the transfer and the resources those operations act on. Publishing one approved collection may require reading a source item, writing an exhibit item, and confirming its status. It does not imply account administration or blanket deletion authority.
An optional challenge after listening can reinforce that distinction. In Bare Metal Cyber Cyber Challenge practice for AutoOps+, reason through two different denials: one where the cloud service refuses to trust the runner's identity assertion, and another where the runner authenticates but cannot write to the approved exhibit collection. Decide which evidence and policy owner belongs to each failure before proposing any new privilege. A single broad administrator role should not be the default remedy for either case.
Permissions have more dimensions than action alone. A policy might allow uploads only to the exhibit collection, only under the production role, or only for approved resources with certain provider-supported attributes. Not every API supports resource-level constraints for every action. Where limits are unavailable in the provider policy, the design may need a narrower account boundary, a dedicated intermediary service, additional application checks, or a separate approval. Least privilege is a combination of provider capabilities and system architecture, not a wish written in a policy document.
There is also a distinction between a machine acting on its own behalf and an application acting with authority delegated by a person. Some APIs use application permissions for background services and delegated permissions when a signed-in user grants an application access within that user's context. Those models should not be confused. The museum's overnight publication job normally has no person present to approve every request. Its service identity should receive exactly the application-level authority required by the approved workflow, not borrow a curator's broad interactive session.
The identity may need access to more than one external API. One provider stores the photographs, another maintains the exhibit index, and a third delivers notifications. Combining all three credentials into one shared administrator identity makes troubleshooting and revocation harder. Separate identities or narrowly scoped grants allow the organization to investigate which part of the workflow issued a request and disable a compromised path without shutting down unrelated services. The resulting operational complexity is justified when the systems have distinct trust and risk boundaries.
Credential lifetime should fit the task, but short lifetime is only one control. A five-minute credential capable of deleting every collection is still excessively powerful. Conversely, a long-lived integration key restricted to one harmless read may pose less immediate damage, although it still deserves protection, monitoring, and a transition plan where better identity mechanisms exist. Combine limited action, limited target, trusted workload, and appropriate lifetime. None of those protections can replace the others.
Long-running work introduces its own timing problem. The museum occasionally imports a large historical collection, which takes longer than a normal exhibit update. If the job's credentials expire partway through, the application must know whether it can obtain new ones and resume safely. Restarting the entire import might create duplicate exhibit entries or overwrite manual annotations made after the first attempt. A durable job design records what has been accepted, reacquires authorized access when supported, and resumes only work that remains necessary.
A failed request should tell the team which boundary rejected it. An identity assertion may be malformed, expired, or issued by an untrusted system. The cloud service may accept the identity and deny an action outside the role's permission. A separate service might reject an access token because it was issued for another audience. Each case needs different evidence. The automation can preserve a safe request identifier, role or application identity, target collection, and time of failure without printing the credential itself.
Audit logs are useful only if they connect to ownership. The museum should be able to answer which workload published a particular photograph, from which approved release, under which machine identity, and with what result. A role named simply production-automation may conceal several unrelated jobs. Stable, dedicated identity names and recorded deployment context make an incident review more informative and give the service owner a reliable way to spot unexpected activity.
Revocation also requires planning. Removing a future trust relationship may stop new sessions while an already issued credential remains valid until its expiration or until a provider-supported revocation control takes effect. Disabling an identity can have different propagation and lifecycle behavior across services. During an incident, the team should know which credentials might still exist, which roles and resources they affect, and what compensating restrictions can be applied. It should not assume one console action instantly invalidates every outstanding request.
The museum's review ends with a narrower design. The production publication workflow receives a dedicated machine identity that can update only the intended public exhibit collection. The cloud trust relationship is limited to the approved workload context. Private archival material and billing resources remain outside its authority. The team also records the identity owner, the expected API actions, the session behavior, and how to investigate an anomalous request. The next normal publication works without using a person's administrator account.
A good access review can be stated as a small operational test. If someone changed the job to delete an unrelated private collection, would the external service refuse even if the request were syntactically valid? If a test workflow attempted to obtain the production role, would its identity claim fail the trust conditions? If an employee left the organization, could the scheduled publication continue without retaining that person's credentials? If the answers are uncertain, the system's successful daily operation is not enough evidence that its identity design is sound.
Machine identities are not a technical afterthought added when an API rejects a request. They are part of the automation architecture: who acts, which system is trusted to introduce the actor, which operations become possible, and who can end the relationship. When those choices are narrow and traceable, a small publishing job remains a small publishing job. When they are broad and unowned, even a routine update can acquire the power to damage systems far outside its purpose.