πŸ”’ Guided

Pre-launch preview. Authorised access only.

Incorrect code

Guided by A Guide to Cloud
Explore AB-900 AI-901
Guided AZ-400 Domain 4
Domain 4 β€” Module 1 of 4 25%
20 of 25 overall

AZ-400 Study Guide

Domain 1: Design and Implement Processes and Communications

  • Work Item Tracking: Boards, GitHub & Flow
  • DevOps Metrics: Dashboards That Drive Decisions
  • Collaboration: Wikis, Teams & Release Notes

Domain 2: Design and Implement a Source Control Strategy

  • Branching Strategies: Trunk-Based, Feature & Release
  • Pull Requests: Policies, Protections & Merge Rules
  • Repository Management: LFS, Permissions & Recovery

Domain 3: Design and Implement Build and Release Pipelines

  • Package Management: Feeds, Versioning & Upstream
  • Testing Strategy: Quality Gates & Release Gates
  • Test Implementation: Code Coverage & Pipeline Tests
  • Azure Pipelines: YAML from Scratch Free
  • GitHub Actions: Workflows from Scratch Free
  • Pipeline Agents: Self-Hosted, Hybrid & VM Templates
  • Multi-Stage Pipelines: Templates, Variables & Approvals
  • Deployment Strategies: Blue-Green, Canary & Ring Free
  • Safe Rollouts: Slots, Dependencies & Hotfix Paths
  • Deployment Implementations: Containers, Scripts & Databases
  • Infrastructure as Code: ARM vs Bicep vs Terraform
  • IaC in Practice: Desired State & Deployment Environments
  • Pipeline Maintenance: Health, Migration & Retention

Domain 4: Develop a Security and Compliance Plan

  • Pipeline Identity: Service Principals, Managed IDs & OIDC Free
  • Authorization & Access: GitHub Roles & Azure DevOps Security
  • Secrets & Secure Pipelines: Key Vault & Workload Federation
  • Security Scanning: GHAS, Defender & Dependabot

Domain 5: Implement an Instrumentation Strategy

  • Monitoring for DevOps: Azure Monitor & App Insights
  • Metrics & KQL: Analysing Telemetry & Traces

AZ-400 Study Guide

Domain 1: Design and Implement Processes and Communications

  • Work Item Tracking: Boards, GitHub & Flow
  • DevOps Metrics: Dashboards That Drive Decisions
  • Collaboration: Wikis, Teams & Release Notes

Domain 2: Design and Implement a Source Control Strategy

  • Branching Strategies: Trunk-Based, Feature & Release
  • Pull Requests: Policies, Protections & Merge Rules
  • Repository Management: LFS, Permissions & Recovery

Domain 3: Design and Implement Build and Release Pipelines

  • Package Management: Feeds, Versioning & Upstream
  • Testing Strategy: Quality Gates & Release Gates
  • Test Implementation: Code Coverage & Pipeline Tests
  • Azure Pipelines: YAML from Scratch Free
  • GitHub Actions: Workflows from Scratch Free
  • Pipeline Agents: Self-Hosted, Hybrid & VM Templates
  • Multi-Stage Pipelines: Templates, Variables & Approvals
  • Deployment Strategies: Blue-Green, Canary & Ring Free
  • Safe Rollouts: Slots, Dependencies & Hotfix Paths
  • Deployment Implementations: Containers, Scripts & Databases
  • Infrastructure as Code: ARM vs Bicep vs Terraform
  • IaC in Practice: Desired State & Deployment Environments
  • Pipeline Maintenance: Health, Migration & Retention

Domain 4: Develop a Security and Compliance Plan

  • Pipeline Identity: Service Principals, Managed IDs & OIDC Free
  • Authorization & Access: GitHub Roles & Azure DevOps Security
  • Secrets & Secure Pipelines: Key Vault & Workload Federation
  • Security Scanning: GHAS, Defender & Dependabot

Domain 5: Implement an Instrumentation Strategy

  • Monitoring for DevOps: Azure Monitor & App Insights
  • Metrics & KQL: Analysing Telemetry & Traces
Domain 4: Develop a Security and Compliance Plan Free ⏱ ~13 min read

Pipeline Identity: Service Principals, Managed IDs & OIDC

Authenticate pipelines with Microsoft Entra service principals, managed identities, and workload identity federation. Configure GitHub Apps, GITHUB_TOKEN, and Azure DevOps service connections.

Why pipeline identity matters

β˜• Simple explanation

Think of a hotel key card system.

When you check in, the front desk gives you a key card. That card only opens YOUR room, the pool, and the gym β€” not every room in the hotel. If you lose it, they deactivate it instantly and give you a new one.

Pipeline identity works the same way. Instead of giving your pipeline a master key (your personal password), you give it its own identity β€” a key card that only opens the rooms it needs, and that can be revoked without affecting anyone else.

Pipelines must authenticate to external services β€” Azure subscriptions, container registries, package feeds, Key Vault. The identity mechanism you choose determines your security posture, operational overhead, and blast radius if credentials leak. This module covers three core identity types in the Microsoft ecosystem and three GitHub authentication mechanisms, all of which appear on the AZ-400 exam.

  • Service principals β€” app registrations in Microsoft Entra ID with client secrets or certificates
  • Managed identities β€” Azure-managed identities with no credentials to store
  • Workload identity federation (OIDC) β€” secretless authentication using token exchange
  • GitHub authentication β€” GITHUB_TOKEN, GitHub Apps, and PATs

Microsoft Entra service principals

A service principal is an identity created in Microsoft Entra ID (formerly Azure AD) for applications, services, and automation tools. When you register an app in Entra ID, a service principal object is created in the tenant.

How pipelines use service principals

  1. Client secret β€” a password string stored as a pipeline secret. Simple but risky: secrets expire (max 2 years), can leak, and must be rotated manually.
  2. Certificate β€” a certificate uploaded to the app registration. More secure than secrets, but certificates still need rotation and secure storage.
  3. Federated credential (OIDC) β€” no secret at all. The pipeline presents a token from its own identity provider, and Entra ID trusts it via federation. This is the modern approach.

Service principal lifecycle

  • Created via Azure Portal, Azure CLI (az ad sp create-for-rbac), or Terraform
  • Assigned RBAC roles at the appropriate scope (subscription, resource group, or resource)
  • Credentials must be rotated before expiry
  • Should follow least-privilege: scope to specific resource groups, not entire subscriptions

Managed identities

Managed identities eliminate credential management entirely for Azure-hosted workloads. Azure handles the token issuance and rotation behind the scenes.

System-Assigned vs User-Assigned Managed Identity
FeatureSystem-AssignedUser-Assigned
Created withThe Azure resource itselfStandalone resource you create separately
LifecycleTied to the resource β€” deleted when resource is deletedIndependent β€” survives resource deletion
Shared across resourcesNo β€” one identity per resourceYes β€” assign to multiple resources
Use caseSingle VM or App Service needs Azure accessMultiple VMs sharing the same identity and permissions
Management overheadLower (auto-created, auto-deleted)Slightly higher (you manage lifecycle)
RBAC assignmentAssign roles to the resource identityAssign roles to the identity, then attach identity to resources

When to use managed identities

  • Self-hosted agents on Azure VMs β€” assign a managed identity to the VM, then the pipeline authenticates without secrets
  • Azure Container Instances / AKS pods β€” use workload identity (user-assigned managed identity federated with Kubernetes service accounts)
  • Azure Functions / App Service β€” system-assigned identity for accessing Key Vault, Storage, SQL

Key limitation: Managed identities only work for Azure-hosted compute. If your pipeline runs on GitHub-hosted runners or on-premises agents, you cannot use managed identities directly β€” you need service principals or workload identity federation.

Question

Your pipeline runs on a GitHub-hosted runner and needs to deploy to Azure. Can you use a managed identity?

Click or press Enter to reveal answer

Answer

No. Managed identities only work on Azure-hosted compute (VMs, AKS, App Service, etc.). For GitHub-hosted runners, use workload identity federation (OIDC) with a service principal that has a federated credential β€” this gives you secretless authentication without needing a managed identity.

Click to flip back

Workload identity federation (OIDC)

Workload identity federation is the recommended approach for pipeline authentication to Azure. It eliminates stored secrets entirely.

How it works

  1. The pipeline’s identity provider (GitHub, Azure DevOps) issues a short-lived OIDC token describing the workflow run
  2. The pipeline presents this token to Microsoft Entra ID
  3. Entra ID validates the token against a pre-configured trust (federated credential on the app registration)
  4. If valid, Entra ID issues an Azure access token β€” no client secret involved

Setting it up

GitHub Actions to Azure:

  • Create an app registration with a federated credential
  • The federated credential specifies: issuer (GitHub), subject (repo + branch/environment/tag), and audience
  • In the workflow, use azure/login@v2 with client-id, tenant-id, and subscription-id (no secret)

Azure Pipelines to Azure:

  • Create a service connection of type β€œWorkload identity federation (automatic)” in Azure DevOps
  • Azure DevOps handles the Entra ID app registration and federated credential automatically
  • The service connection uses OIDC β€” no secret stored
πŸ’‘ Scenario: Amira eliminates secrets for Major Collins

πŸ›οΈ Dr. Amira Hassan is auditing Major Collins’ defence project. The Azure Pipelines service connections use client secrets expiring in 30 days, and no one has rotated them in 18 months.

Amira’s remediation:

  1. Creates new service connections using β€œWorkload identity federation (automatic)” β€” Azure DevOps generates the Entra app and federated credential
  2. Updates all pipeline YAML to reference the new service connections
  3. Removes the old service connections and their expired secrets
  4. Adds a policy requiring all new service connections to use workload identity federation

Result: Zero secrets to rotate, zero risk of credential leakage. The OIDC tokens are short-lived (valid for minutes, not months).

Question

What three values does a GitHub Actions workflow need to authenticate to Azure via workload identity federation (OIDC)?

Click or press Enter to reveal answer

Answer

1. client-id (the app registration's application/client ID), 2. tenant-id (the Entra ID tenant ID), 3. subscription-id (the target Azure subscription). No client-secret is needed β€” the workflow presents its GitHub OIDC token, which Entra ID validates against the federated credential trust.

Click to flip back

GitHub authentication mechanisms

GitHub Authentication: GITHUB_TOKEN vs GitHub Apps vs PATs
FeatureGITHUB_TOKENGitHub AppPersonal Access Token (PAT)
ScopeSingle repository (the one running the workflow)Configurable per-repo or per-org installationAll repos the user can access
LifetimeExpires when the workflow job endsInstallation token: 1 hour. App lives until removedUp to 1 year (fine-grained) or no expiry (classic)
PermissionsDefault read for contents, write for the same repoGranular per-permission (issues, PRs, contents, etc.)Scope-based (classic) or granular (fine-grained)
Identitygithub-actions botThe GitHub App (its own identity)The user who created it
Triggers other workflowsNo (prevents recursive loops)YesYes
RotationAutomatic (per job)Automatic (per installation token request)Manual
Best forStandard in-repo operationsCross-repo automation, org-wide botsLocal development, one-off scripts

GITHUB_TOKEN

Automatically available in every GitHub Actions workflow as github.token. Default permissions are configurable at the repo or org level. Since November 2023, the default for new repos is read-only β€” you must explicitly grant write permissions in the workflow YAML:

permissions:
  contents: read
  pull-requests: write
  issues: write

GitHub Apps

A GitHub App is a first-class integration identity. In CI/CD, Apps are preferred when you need:

  • Cross-repository operations (e.g., a workflow in repo A creating issues in repo B)
  • A distinct identity for audit (not β€œgithub-actions” and not a personal user)
  • Fine-grained permissions without tying to a human account

Personal access tokens (PATs)

Fine-grained PATs (recommended) β€” scoped to specific repos and permissions, with mandatory expiry. Classic PATs β€” broad scope-based tokens. Avoid for pipelines; they grant access to all repos the user can see.

Question

Why does GITHUB_TOKEN NOT trigger other GitHub Actions workflows by default?

Click or press Enter to reveal answer

Answer

To prevent infinite recursive loops. If a workflow pushes a commit using GITHUB_TOKEN, that push event will not trigger another workflow run. If you need to trigger downstream workflows, use a GitHub App installation token or a PAT instead.

Click to flip back

Azure DevOps service connections

Service connections are the Azure DevOps equivalent of configuring external service credentials. They are defined at the project level and can be shared across pipelines.

Service connection types for Azure

Connection TypeAuthenticationSecret Management
Workload identity federation (automatic)OIDC β€” Azure DevOps manages the Entra appNo secrets (recommended)
Workload identity federation (manual)OIDC β€” you manage the Entra app and federated credentialNo secrets
Service principal (automatic)Client secret β€” Azure DevOps creates the Entra appSecret stored, auto-rotated by Azure DevOps
Service principal (manual)Client secret or certificate β€” you manage everythingSecret stored in service connection
Managed identityManaged identity on self-hosted agent VMNo secrets (Azure-hosted agents only)

Service connection security

  • Pipeline permissions β€” restrict which pipelines can use a service connection
  • Approvals and checks β€” require approval before a pipeline can use the connection (critical for production)
  • Branch restrictions β€” limit service connection usage to specific branches (e.g., only main can deploy to production)

Azure DevOps PATs

Azure DevOps PATs authenticate REST API calls and Git operations. Key practices:

  • Scope to specific organisations and projects
  • Set the shortest practical expiry
  • Use managed identities or service principals for automation where possible
  • PATs inherit the user’s permissions β€” if the user is a Project Admin, the PAT is too
Question

What is the recommended service connection type in Azure DevOps for authenticating to Azure resources?

Click or press Enter to reveal answer

Answer

Workload identity federation (automatic). Azure DevOps creates the Entra ID app registration and federated credential for you, handles OIDC token exchange, and stores no secrets. This is Microsoft's recommended approach since late 2023.

Click to flip back

πŸ’‘ Exam tip: Identity decision tree

The exam may present a scenario and ask you to choose the right identity mechanism. Use this decision tree:

  1. Is the pipeline hosted on Azure compute? (self-hosted agent on VM, AKS, etc.)
    • Yes, and single resource β†’ System-assigned managed identity
    • Yes, and shared across resources β†’ User-assigned managed identity
  2. Is the pipeline on GitHub Actions or Azure DevOps (hosted runners)?
    • Use workload identity federation (OIDC) β€” secretless, no rotation needed
  3. Do you need cross-repo operations in GitHub?
    • Use a GitHub App (not GITHUB_TOKEN, not PAT)
  4. Is a human running a one-off script?
    • Use a fine-grained PAT with minimal scope and short expiry
  5. Fallback: Service principal with client secret β€” only when OIDC and managed identities are not possible
Question

In Azure DevOps, what three security controls can you apply to a service connection?

Click or press Enter to reveal answer

Answer

1. Pipeline permissions β€” restrict which pipelines can reference the connection. 2. Approvals and checks β€” require human approval before the connection is used (critical for production). 3. Branch restrictions β€” limit usage to specific branches (e.g., only 'main' can deploy to production).

Click to flip back

Knowledge check

Knowledge Check

Kai's startup runs all CI/CD on GitHub-hosted runners. He needs pipelines to deploy to Azure without storing any secrets. What should he configure?

Knowledge Check

Nadia needs a GitHub Actions workflow in the 'deploy-tools' repo to create issues in five other repositories when a deployment fails. GITHUB_TOKEN is insufficient. What should she use?

Knowledge Check

Dr. Amira's client has self-hosted Azure DevOps agents running on Azure VMs. Each agent deploys to different Azure subscriptions. What identity approach minimises operational overhead?

🎬 Video coming soon

Pipeline Identity: Service Principals, Managed IDs & OIDC

Next up: Authorization and Access: GitHub Roles and Azure DevOps Security

← Previous

Pipeline Maintenance: Health, Migration & Retention

Next β†’

Authorization & Access: GitHub Roles & Azure DevOps Security

Guided

I learn, I simplify, I share.

A Guide to Cloud YouTube Feedback

© 2026 Sutheesh. All rights reserved.

Guided is an independent study resource and is not affiliated with, endorsed by, or officially connected to Microsoft. Microsoft, Azure, and related trademarks are property of Microsoft Corporation. Always verify information against Microsoft Learn.