AZ-400 domain - 13% of the exam

Develop a Security and Compliance Plan

Develop a Security and Compliance Plan is 13% of the AZ-400 exam. These are the objectives it covers, each with practice questions, with every answer explained.

The domain in numbers

36
Practice questions
3
Objectives
36
Hard

Where people go wrong

  • Treating a stored secret as no credential

    Moving a client secret into Azure Key Vault, rotating it often, swapping it for a certificate, or encrypting it in GitHub can look like removing the credential. Each option still leaves a long-lived secret or private key that the pipeline must hold and present. Workload identity federation removes it: Azure DevOps or GitHub Actions presents a short-lived OpenID Connect token, and Microsoft Entra exchanges it through a federated credential for an access token, so nothing is stored.

    See it in a sample question
  • Confusing system-assigned and user-assigned managed identities

    The wrong answers pick the identity type that does not match the lifetime or sharing the scenario describes. A system-assigned identity belongs to one resource and is deleted with it, so several scale sets or apps would need separate grants, and recreating one loses access. A user-assigned managed identity is a standalone resource that many resources can share and that outlives any of them, so one grant on the vault persists.

    See it in a sample question
  • Giving a GitHub Advanced Security feature another feature's job

    The wrong options attach a scanning task to the wrong feature, because each one raises alerts. CodeQL analyses the team's own source and raises code scanning alerts. Dependabot alerts and security updates cover vulnerable dependencies and open upgrade pull requests. Secret scanning matches credential patterns, and custom patterns cover organisation-specific token formats. The dependency graph and dependency review supply the component and licence inventory.

    See it in a sample question
  • Treating a personal access token as an Azure credential

    A personal access token authenticates to Azure DevOps itself. The wrong answers offer one for deploying to an Azure subscription, reading Azure Key Vault or calling a Microsoft Entra protected API, where it cannot work, and it is still a long-lived secret. Access to Azure needs a Microsoft Entra identity such as a service principal, a managed identity or a federated credential.

    See it in a sample question
  • Widening permissions to fix a federated credential

    When a federated credential trusts too little or too much, the wrong answers change something other than the trust itself. They widen directory permissions, raise the role assignment to Owner, or put a role assignment inside the credential. The issuer names the trusted token provider, the audience must match what Azure login expects, and the subject identifies the caller: it differs between branch and pull request triggers and can name a protected environment or one service connection. Authorisation stays a separate Azure role assignment.

    See it in a sample question

Objectives in this domain

What to study

The official documents this domain's practice questions cite most.

Sample questions from this domain

Free sampleDevelop a Security and Compliance Planhard

An "Azure Pipelines" YAML pipeline deploys to Azure using a service connection that currently stores a Microsoft Entra service principal client secret. The security team mandates that the pipeline hold no long-lived credential of any kind, and the secret must not simply be moved into "Azure Key Vault". Which approach to the service connection meets this requirement?

  • AConfigure the service connection to use workload identity federation, where Azure DevOps presents a short-lived OpenID Connect token that Microsoft Entra exchanges for an access token without any stored secret. Correct
  • BRotate the service principal client secret automatically every seven days through a scheduled pipeline so that any leaked secret is short-lived and quickly invalidated before it can be reused by an attacker.
  • CStore the service principal client secret in "Azure Key Vault" and have the pipeline read it at run time through a Key Vault task so the secret never appears in the pipeline definition or variables.
  • DReplace the client secret with a Microsoft Entra service principal certificate uploaded to the service connection, since certificate-based authentication is stronger and avoids storing a password-style secret in the pipeline.
Choose workload identity federation so an Azure Pipelines service connection authenticates to Azure with no stored long-lived credential. Workload identity federation configures a federated trust between the Azure DevOps service connection and a Microsoft Entra application, so at run time the pipeline presents a short-lived OpenID Connect token that Entra exchanges for an Azure access token. No client secret or certificate is stored, which is the only option that removes the long-lived credential rather than relocating or shortening it.

Why A is correct: Workload identity federation establishes a trust between Azure DevOps and Microsoft Entra so the pipeline authenticates with a short-lived OpenID Connect token exchanged for access, leaving no client secret or long-lived credential anywhere.

Why B is wrong: Frequent rotation shortens a secret's useful life but the pipeline still stores and presents a standing client secret between rotations, so a long-lived credential remains and the mandate is not satisfied.

Why C is wrong: A Key Vault lookup keeps the secret out of the YAML, but it is exactly the move the requirement forbids and the underlying client secret is still a long-lived credential the deployment depends on.

Why D is wrong: A certificate is stronger than a password-style secret, but the private key is still a long-lived credential the pipeline must hold and rotate, so it does not meet the no-long-lived-credential mandate.

Free sampleDevelop a Security and Compliance Planhard

A self-hosted "Azure Pipelines" agent runs on an Azure virtual machine and needs to read secrets from "Azure Key Vault" during deployments. The team wants the virtual machine's own identity to be used so that no credential is configured anywhere in the pipeline or on the agent, and the identity exists only for the lifetime of that virtual machine. Which approach should the team use?

  • ARegister a Microsoft Entra service principal for the agent, store its client secret as a secret pipeline variable, and grant the principal a get and list access policy so the deployment can read the vault secrets.
  • BCreate a user-assigned managed identity in a shared resource group, assign it to the virtual machine, and grant it a get and list access policy so multiple agents can reuse the same identity to read secrets.
  • CEnable a system-assigned managed identity on the virtual machine, grant it a get and list access policy on the key vault, and have the deployment read secrets using that identity through the instance metadata endpoint. Correct
  • DInstall a personal access token on the agent scoped to secrets, configure the deployment task to send that token to the vault, and rely on the token expiry date to limit how long the credential remains valid.
Select a system-assigned managed identity when an Azure resource needs credential-free access tied strictly to that resource's lifetime. A system-assigned managed identity is created in Microsoft Entra and bound to a single Azure resource, sharing its lifecycle and disappearing when the resource is deleted. The virtual machine obtains tokens from the instance metadata endpoint with no stored secret, and a key vault access policy lets it read secrets, matching the lifecycle and credential-free requirements.

Why A is wrong: A service principal with a stored secret would work and is tempting, but it places a credential in the pipeline and its lifetime is independent of the virtual machine, breaking both stated conditions.

Why B is wrong: A user-assigned identity also avoids stored credentials, but it is a standalone resource that survives beyond the virtual machine and is meant for sharing, so it does not exist only for that machine's lifetime.

Why C is correct: A system-assigned managed identity is tied to the virtual machine's lifecycle and needs no stored credential, and granting it get and list on the vault lets the agent read secrets, which satisfies every stated condition.

Why D is wrong: Personal access tokens authenticate to Azure DevOps, not to "Azure Key Vault", and storing one on the agent is exactly the configured credential the team wants to avoid, so it cannot read the vault.

Free sampleDevelop a Security and Compliance Planhard

A Node.js project on "GitHub" depends on many open-source packages. The team needs to be alerted when any of those dependencies has a newly disclosed known vulnerability, and to receive automated pull requests that bump the affected package to a fixed version. Which configuration delivers both the alerting and the automated remediation pull requests?

  • AEnable CodeQL code scanning on a schedule so its queries inspect each imported package for known vulnerabilities and raise a pull request upgrading any dependency that matches a vulnerable signature.
  • BEnable Dependabot alerts and Dependabot security updates so the project is alerted to vulnerable dependencies from the advisory database and receives automated pull requests bumping each to a fixed version. Correct
  • CEnable secret scanning with push protection so that any push pulling in a vulnerable package version is blocked, forcing developers to update the dependency manifest before the change can be committed.
  • DTurn on a Microsoft Defender for Cloud DevOps connector so it inventories the manifest and emails the team about vulnerable packages, then manually edit the lockfile each time to pin a patched version.
Use Dependabot alerts with security updates to detect vulnerable open-source dependencies and auto-raise upgrade pull requests. Dependabot compares the dependency manifest and lockfile against the GitHub Advisory Database to raise alerts, and Dependabot security updates then open pull requests that bump each vulnerable package to the minimum fixed version. This pairing provides both the notification and the automated remediation that the requirement specifies.

Why A is wrong: CodeQL analyses your own source, not the advisory status of dependencies, and does not open upgrade pull requests; it is tempting as a security scanner, but it does not consult the advisory database or bump versions.

Why B is correct: Dependabot alerts cross-reference the manifest against the advisory database to notify the team, and Dependabot security updates open pull requests that raise the affected package to a patched version, satisfying both stated needs.

Why C is wrong: Secret scanning detects credentials, not vulnerable package versions, and would never match a dependency entry; it is tempting because it blocks bad pushes, but it has no knowledge of vulnerability advisories.

Why D is wrong: A Defender connector can surface dependency findings for posture reporting, but it does not generate the automated upgrade pull requests; it is tempting because it alerts on vulnerabilities, yet the remediation here would be manual.

Free sampleDevelop a Security and Compliance Planhard

A workload identity federation trust is configured between a Microsoft Entra application and a GitHub repository. Deployments succeed from workflows triggered on the main branch but fail authentication when triggered from pull request workflows. The platform team wants pull request runs to also authenticate while still keeping the trust as narrow as possible. What is the most appropriate change?

  • AAdd a second federated identity credential on the application whose subject matches the pull request entity for that repository, leaving the existing branch credential unchanged. Correct
  • BGrant the Microsoft Entra application broader directory permissions so its token requests are accepted regardless of which GitHub branch or pull request triggered the workflow run.
  • CReplace the existing federated credential with one whose subject uses a wildcard so any branch, tag, or pull request from the repository is trusted by the Microsoft Entra application.
  • DStore a fallback service principal client secret as a GitHub secret and have pull request workflows authenticate with that secret instead of through the federated OpenID Connect trust.
Add a federated identity credential matching the pull request subject so those workflow runs authenticate without broadening the trust. GitHub sets the OpenID Connect subject claim differently for branch triggers and pull request triggers, and a federated identity credential authorises only tokens whose subject matches its configured value. Adding a second credential scoped to the repository's pull request subject authorises those runs precisely, keeping each credential narrow rather than trusting every ref through a wildcard.

Why A is correct: The subject claim differs between branch and pull request triggers, so adding a federated credential whose subject targets the repository's pull request entity authorises those runs while keeping each credential narrowly scoped.

Why B is wrong: Token acceptance is governed by the federated credential's subject match, not directory permissions, so widening permissions does nothing to fix the failure and needlessly increases the application's privilege.

Why C is wrong: A wildcard subject would technically include pull requests, but it trusts every ref in the repository, which is the opposite of keeping the trust narrow and broadens the attack surface unnecessarily.

Why D is wrong: A fallback secret would let pull request runs authenticate, but it reintroduces a stored long-lived credential and abandons secretless federation, defeating the reason the federation was set up.

Other domains in this exam

See also the AZ-400 cert hub, the study guide, and the cheat sheet.

Examworthy is not affiliated with or endorsed by Microsoft. Original, blueprint-aligned practice material only.