Protego field desk
Security and Compliance Plan · 10-15% of exam

L15. Authentication, Authorization & Secrets Management: Managed Identities, Service Connections & Key Vault

Course outlineLesson 15 of 18
AZ-400 Exam Prep: course overview

Managed identities handle credential rotation, federation avoids stored client secrets, and Azure Pipelines secure files protect certificates and other file-based credentials.

Service Principals vs Managed Identities

A service principal is an application identity in Microsoft Entra ID. It can authenticate using a certificate, client secret or federated credential. Non-Azure workloads can use workload identity federation, avoiding a stored client secret.

A managed identity is a special type of service principal for an Azure-native identity whose credentials are created and rotated by Azure automatically, removing manual credential rotation; you still manage permissions and protect the workload. Managed identities come in two types: system-assigned (one per Azure resource) and user-assigned (standalone resources assignable to multiple resources).

Choosing the Right Identity

Managed identities are strongly preferred whenever a workload runs on an Azure resource and only needs to authenticate to other Azure resources in the same tenant. Examples include Azure Functions, App Service, VMs, and container instances. Azure manages credential rotation, but a compromised workload can still obtain and misuse its access tokens.

For workloads outside Azure, prefer federation when supported. Authorization and resource trust still determine which tenant and service the identity can access.

GitHub and Azure DevOps Authentication

Both platforms offer credential types suited to different scenarios:

Credential TypeLifetimeBest For
GITHUB_TOKENJob-scoped; expires when the job finishes or reaches its maximum token lifetimeWithin-repository operations
GitHub AppsShort-lived access tokens; manage the App private key separatelyFine-grained automation
Personal access tokensConfigured expiry or revocationLegacy workflows only
GITHUB_TOKEN is ideal for most in-repository work. GitHub Apps are preferred for automation outside your repository. Personal access tokens are a fallback only when GitHub Apps are unsuitable.

Workload Identity Federation (OIDC)

Workload identity federation (OpenID Connect) eliminates storing long-lived credentials entirely. GitHub Actions or Azure Pipelines exchanges a short-lived OIDC token for Azure access tokens at run time. Configure the trust relationship once, then no client secret needs to be stored or rotated. This removes an entire class of leakable credentials from your CI/CD system.

Azure DevOps Service Connections and Secure Files

A service connection in Azure Pipelines encapsulates credentials a pipeline needs to reach an external service. Azure Resource Manager service connections can federate with an app registration or a user-assigned managed identity, or use other supported credential types, and can be restricted to specific pipelines.

Azure Pipelines secure files store and encrypt file-based sensitive content (certificates, provisioning profiles) that string secret variables cannot represent. Azure downloads these to the agent only at job run time and deletes them afterward.

Preventing Secret Leakage

Mark pipeline variables as secret so they are masked in logs (though masking is best-effort, not a guarantee). Avoid echoing secret values directly in script steps. Design pipelines so secrets are only used where needed, and prefer OIDC or managed identities over stored client secrets whenever possible.

Permissions and Access Levels

GitHub offers five permission levels (read, triage, write, maintain, admin) plus outside collaborator access. Azure DevOps separates security groups (Project Administrators, Contributors, Readers) from access levels (such as Basic and Stakeholder). Stakeholder limits available features; it does not replace project permissions or membership.

References

Continue Learning

Exam Focus Points
  • ✓Managed identities (system-assigned or user-assigned) have their credentials fully created and rotated by Azure automatically, and are preferred over manually managed application credentials when a workload runs on Azure and only needs to reach other Azure resources
  • ✓GITHUB_TOKEN is an automatically generated, short-lived, job-scoped token requiring no manual secret setup, while GitHub Apps offer fine-grained, revocable permissions preferred over broad personal access tokens for automation
  • ✓Workload identity federation (OpenID Connect) lets GitHub Actions and Azure Pipelines authenticate to Azure by exchanging a short-lived federated token at run time instead of storing a long-lived client secret, removing a class of leakable credential entirely
  • ✓Azure DevOps Stakeholder is an access level, distinct from security-group permissions; GitHub outside collaborators receive repository roles without organization membership
  • ✓Azure Pipelines secure files store and encrypt file-based sensitive content (certificates, provisioning profiles), downloading them to the agent only at run time and cleaning them up afterward, which is distinct from simple string-based secret variables
Knowledge Check

1. A workload running on an Azure Function only needs to read secrets from an Azure Key Vault in the same tenant. What authentication approach avoids managing application credentials?

2. What is the security advantage of workload identity federation (OIDC) over storing a client secret as a GitHub Actions secret for authenticating to Azure?

3. A business stakeholder needs to view and comment on Azure Boards work items for visibility into project status, but needs only limited Azure Boards features without a paid access level. What access level fits this?