AZ-401 Practice Test

AZ-401 Domain 4: Design and implement a security and compliance plan

15–20% of the exam (AZ-400: 10–15%). 13 skills in 3 tasks. Study notes for each task below, then 7 free questions with answers.

52 Domain 4 questions in the bank, 7 free. Answer them one at a time with explanations.

Practice Domain 4

Skill wording is quoted from the official study guide. Tags compare each skill with the AZ-400 guide.

4.1 Design and implement authentication and authorization methods

Task 4.1 covers the identities that pipelines and people use: managed identities versus service principals, GitHub Apps, GITHUB_TOKEN and personal access tokens, OIDC federation, Azure DevOps service connections, and access levels, roles and teams on both platforms. Most questions hinge on least privilege and on removing stored secrets.

  • 4.1.1Choose between Microsoft Entra service principals and managed identities for Azure resources 4 questions
  • 4.1.2Implement and manage GitHub authentication, including GitHub Apps, GITHUB_TOKEN, and personal access tokens 5 questions
  • 4.1.3Implement and manage secretless authentication in Azure Pipelines and GitHub Actions 5 questions
  • 4.1.4Implement and manage Azure DevOps service connections and personal access tokens 5 questions
  • 4.1.5Design and implement permissions and access levels in Azure DevOps and GitHub 4 questions
  • 4.1.6Configure projects in Azure DevOps (ADO) and GitHub, including ADO teams 3 questions

Service principal or managed identity: which one does a scenario call for?

Use a managed identity for workloads hosted in Azure and a service principal for workloads outside Azure; a service principal authenticates with a certificate, a federated credential or a secret. A system-assigned identity is part of one resource, only that resource can use it, and its service principal is deleted with the resource. A user-assigned identity is a standalone resource: it can be created and authorized before the compute exists, shared by many resources, and must be deleted explicitly. Neither stores a credential you rotate. To call Azure DevOps, add the service principal or managed identity to the organization with an access level (Basic or higher for Azure Repos) and group memberships; Microsoft Entra application permissions and Entra group membership alone don't authorize it, and group rules for access levels don't apply to it. The workload requests a Microsoft Entra token for Azure DevOps and sends it as a bearer token. Application identities can't create PATs.

Source: What is managed identities for Azure resources?; Use service principals and managed identities in Azure DevOps

GITHUB_TOKEN, GitHub App or fine-grained PAT: which token fits which automation?

GITHUB_TOKEN is created per job and reaches only the workflow's own repository. When a permissions block lists any permission, every unlisted permission becomes none, so a job that checks out code and opens issues needs contents: read and issues: write. Events caused by GITHUB_TOKEN don't start new workflow runs, except workflow_dispatch and repository_dispatch. The organization setting Allow GitHub Actions to create and approve pull requests controls whether it can open and approve pull requests. A GitHub App isn't tied to a user, uses no seat, survives staff leaving, is limited to the repositories chosen at installation, gets rate limits that scale, and its installation token does trigger workflows. Fine-grained PATs are limited to one resource owner, selected repositories and specific permissions, and organization owners can require approval for them; classic PATs can't be put through approval, so restrict classic token access to the organization instead.

Source: GITHUB_TOKEN; Deciding when to build a GitHub App

How do I sign in from GitHub Actions to Azure with OIDC, and why doesn't the federated credential match?

Create a federated credential on a Microsoft Entra app registration or a user-assigned managed identity, with audience api://AzureADTokenExchange. The job needs id-token: write; it lets the job request a JWT and grants no write access to resources. The subject must match exactly and wildcards aren't supported. A job that references an environment sends repo:ORG/REPO:environment:NAME; a pull request run without an environment sends repo:ORG/REPO:pull_request; otherwise the subject is the ref, such as repo:ORG/REPO:ref:refs/heads/main. Add one credential per context; an app registration allows up to 20. Repositories created, renamed or transferred after July 15, 2026 use an immutable subject with IDs, such as repo:octo-org@123456/octo-repo@456789:ref:refs/heads/main, so a value copied from an older repository won't match.
permissions:
  id-token: write
  contents: read
steps:
- uses: azure/login@v2
  with:
    client-id: ${{ secrets.AZURE_CLIENT_ID }}
    tenant-id: ${{ secrets.AZURE_TENANT_ID }}
    subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

Source: Configuring OpenID Connect in Azure; OpenID Connect reference

How do Azure DevOps service connections and PATs work without long-lived secrets?

An Azure Resource Manager service connection with workload identity federation stores no secret. The automatic option creates an app registration, so it fails where the tenant blocks app registration creation; the Managed identity option adds a federated credential to an existing user-assigned managed identity instead. The conversion tool only converts connections Azure DevOps created itself and that one project uses; manually created service principals and cross-project connections can't be converted. The Azure DevOps issuer for federation retires on July 1, 2027; new connections use the Microsoft Entra issuer, and flagged connections convert with Update. The Azure DevOps service connection type reaches another organization's repositories through federation without a PAT. Pipeline permissions on a connection are Open access or a list of authorized pipelines. For PATs, the organization policy Restrict personal access token (PAT) creation, with an allowlist and a packaging-scope-only option, limits who creates them; the tenant policy Enforce maximum personal access token lifespan caps their lifetime.

Source: Connect to Azure with an Azure Resource Manager service connection; Manage personal access tokens using policies (for administrators)

Which Azure DevOps access level, role or setting gives each person only what they need?

Stakeholder access is free for unlimited users: it creates and edits work items and views and approves releases, but gives no Azure Repos access in private projects and no test plan authoring. Basic adds code, pipelines and boards. Creating test plans and suites and authoring manual test cases needs Basic + Test Plans or an equivalent Visual Studio subscription. An access level unlocks features; permissions still come from security groups. A team administrator adds team members and configures that team's backlogs, boards and Taskboards without project-level rights; Project Administrators can change service connections and security groups, which is far broader. A Project Administrator can turn whole services such as Repos or Test Plans off on the project Overview page; the service disappears for every member and its data is still there when it is turned back on.

Source: About access levels; Create or add a team

Which GitHub role, base permission or team structure gives least privilege?

Repository roles from lowest to highest are Read, Triage, Write, Maintain and Admin. Triage can apply labels and milestones, assign, close and reopen issues and pull requests, and request reviews, but can't push, merge or approve. Managing webhooks and deploy keys stays with Admin, so a custom repository role that inherits Write and adds Manage webhooks is the least-privilege fit; custom repository roles need GitHub Enterprise Cloud and apply only where assigned, while custom organization roles span all repositories. Base permissions apply to every organization member on every repository, not to outside collaborators, who get access only to repositories they're added to and can't join teams. Child teams inherit the parent team's repository access, so grant extra access to the child team only. Visible teams can be seen and @mentioned by every member; secret teams can't be nested.

Source: Repository roles for an organization; About organization teams

Traps in 4.1 questions

  • Listing only issues: write in a permissions block sets contents to none, so actions/checkout fails; every needed permission must be listed.
  • A PAT does trigger workflows like a GitHub App token, but it is tied to a person's account; when the requirement is no user dependency, the answer is a GitHub App.
  • When a GitHub Actions job references an environment, the OIDC subject contains the environment, not the branch, so a branch-based federated credential never matches.
  • Adding a service principal to a Microsoft Entra group or granting it Entra API permissions does not let it call Azure DevOps; it must be added to the organization with an access level.

26 questions in the bank test task 4.1. Practice Domain 4

4.2 Design and implement a strategy for managing sensitive information in automation

Task 4.2 covers where pipeline secrets live and how they reach a job without leaking: Key Vault integration, secret and key lifecycle, secure files and GitHub secret scopes, and log masking and fork protections. Questions hinge on which store or scope satisfies an approval, rotation or no-leak constraint.

  • 4.2.1Integrate Azure Key Vault into Azure Pipelines and GitHub Actions 4 questions
  • 4.2.2Implement and manage secrets, keys, and certificates 3 questions
  • 4.2.3Design and implement a strategy for managing sensitive information during deployment, including Azure Pipelines secure files and GitHub secrets 4 questions
  • 4.2.4Design Azure Pipelines and GitHub Actions to prevent leakage of sensitive information 5 questions

How do I pull Azure Key Vault secrets into Azure Pipelines?

Two options use a service connection's identity. The AzureKeyVault@2 task downloads the secrets named in SecretsFilter (a comma-separated list or *) as secret variables for later steps. A Key Vault-linked variable group maps chosen secret names once for many pipelines: value changes flow through at run time, but secrets added to the vault must be selected in the group explicitly. Variable groups map only secrets, not keys or certificates. The identity needs Get and List on secrets with the access policy model, or Key Vault Secrets User at vault scope with the RBAC model; Key Vault Reader returns only metadata and Secrets Officer can also set and delete. Variable groups support RBAC vaults only over a public endpoint, so a vault behind a private endpoint uses the access policy model. Azure DevOps isn't an Azure trusted service.
- task: AzureKeyVault@2
  inputs:
    azureSubscription: 'SERVICE_CONNECTION_NAME'
    KeyVaultName: 'KEY_VAULT_NAME'
    SecretsFilter: '*'
    RunAsPreJob: false

Source: Use Azure Key Vault secrets in Azure Pipelines; Link a variable group to secrets in Azure Key Vault

What do soft delete, purge protection and rotation policies guarantee in Key Vault?

Soft delete keeps deleted vaults and objects recoverable for 7 to 90 days (90 by default); the period is set at vault creation and can't be changed. Soft delete alone still allows a privileged user to purge a deleted object at once. With purge protection, which is off by default and requires soft delete, nothing in the deleted state can be purged until the retention period passes, even by a subscription Owner. Microsoft recommends it whenever keys are used for encryption. A key rotation policy uses lifetime actions: Rotate creates a new key version on schedule and Notify raises the near-expiry Event Grid event; a storage account that references a versionless key URI picks up the new version automatically. Rotation policies are for keys. For a secret such as a storage account key with two credentials, the pattern is a near-expiry Event Grid event that triggers a function to regenerate the key not in use and store it as a new secret version.

Source: Azure Key Vault soft-delete overview; Configure cryptographic key auto-rotation in Azure Key Vault

Secure files, variable groups or GitHub environment secrets: where do signing files and deployment secrets go?

In Azure Pipelines, a secure file such as a keystore or provisioning profile is encrypted at rest, usable only from a pipeline task, and is a protected resource, so you authorize specific pipelines and add approvals and checks; DownloadSecureFile@1 puts it on the agent. A secure file can be at most 10 MB. A secret pipeline variable can't carry approvals or checks. In GitHub Actions, secrets exist at organization, repository and environment level. Organization secrets are limited by a repository access policy. Environment secrets reach only jobs that reference the environment, and with required reviewers the job can't read them until someone approves; deployment branch rules can restrict the environment to main. Secrets are limited to 48 KB; for larger ones, commit a gpg-encrypted file and store the passphrase as a secret, and use Base64 for small binary blobs. Every job in a repository can read repository secrets, so they don't satisfy an approval requirement.

Source: Use secure files; Using secrets in GitHub Actions

Which secrets do Dependabot, fork and Copilot cloud agent runs receive?

Except for GITHUB_TOKEN, secrets aren't passed to workflows triggered from a fork. Workflows triggered by Dependabot are treated the same way: Actions secrets, including organization Actions secrets, aren't available, and only Dependabot secrets are passed. A Dependabot secret with the same name is read through the same secrets context, so one workflow works for human and Dependabot pull requests without changing the trigger. Copilot cloud agent receives only its own Agents secrets and variables, set at repository or organization level; it doesn't get Actions, Codespaces or Dependabot secrets. Only Agents secrets whose names start with COPILOT_MCP_ are available to its MCP server configuration. Secrets once stored in the copilot environment were migrated to the Agents type, and that environment is no longer the supported place for them.

Source: Troubleshooting Dependabot on GitHub Actions; Configure secrets and variables for Copilot cloud agent

How do I stop Azure Pipelines from leaking secrets into logs or to untrusted runs?

Azure Pipelines masks the exact secret value but never substrings, so a field inside a JSON secret prints in clear text; store one value per secret. Secret variables aren't decrypted into environment variables automatically; map them with env: and never pass them on the command line, because some systems log arguments. A value created in a script becomes masked only when set with ##vso[task.setvariable variable=name;issecret=true]; isOutput shares it with later jobs and isreadonly blocks overwrites, but neither masks. Turning on Limit variables that can be set at queue time lets users set only variables marked settable at queue time, from the UI and REST API; set at organization level, projects can't turn it off. For GitHub fork pull requests, the organization control Limit building pull requests from forked GitHub repositories with Securely build withholds secrets, withholds regular-build permissions and requires a pull request comment to start a build.

Source: Set secret variables; Build GitHub repositories

How do I use Key Vault values in GitHub Actions without a stored credential or a log leak?

Sign in with azure/login and OIDC: the job needs permissions: id-token: write, and the workflow stores only the client, tenant and subscription IDs, not a client secret. A value fetched from Key Vault at run time isn't a GitHub secret, so the runner doesn't redact it; emit ::add-mask::VALUE before anything prints it. enable-AzPSSession only adds an Azure PowerShell session. Avoid passing secrets on the command line, because other processes and audit events can see arguments; use environment variables or STDIN. Secrets can't be referenced directly in if: conditions; set them as job-level environment variables and test those. pull_request_target runs with the base repository's token and secrets, so checking out and running the fork's code there exposes them. Run untrusted code under pull_request, which has a read-only token and no secrets, and do privileged follow-up in a workflow_run workflow that doesn't execute pull request code.

Source: Use the Azure Login action with OpenID Connect; Securely using pull_request_target

Traps in 4.2 questions

  • A Key Vault-linked variable group picks up new values of mapped secrets automatically but never adds new secret names; a missing secret means editing the group, not fixing permissions.
  • Key Vault Reader sounds sufficient for reading secrets but returns metadata only; the role that reads secret values is Key Vault Secrets User.
  • Soft delete is not enough when nobody may purge: only purge protection blocks purging until the retention period ends.
  • An organization Actions secret is still an Actions secret, so Dependabot-triggered runs don't receive it; the fix is a Dependabot secret with the same name.

16 questions in the bank test task 4.2. Practice Domain 4

4.3 Automate security and compliance scanning

Task 4.3 covers automated SAST, SCA, secret and IaC scanning on GitHub and Azure DevOps and surfacing the results in Microsoft Defender for Cloud. Questions hinge on which product licenses which feature, which setup runs without pipeline changes, and which check blocks a pull request.

  • 4.3.1Design a strategy for security, vulnerability, and compliance scanning 2 questions
  • 4.3.2Configure dependency scanning, code scanning, and secret scanning by using GitHub Advanced Security for Azure DevOps and GitHub Advanced Security 5 questions
  • 4.3.3Connect Microsoft Defender for Cloud DevOps Security to other DevOps environments, including Azure DevOps and GitHub 3 questions

Which tool covers each layer of a security scanning strategy?

Map each risk to a scanner and to the point where it runs. Secrets: push protection blocks them before they reach the repository, and secret scanning alerts on what is already in history. Open-source dependencies (SCA): the dependency review action compares dependency changes in a pull request and can fail the check by advisory severity and by license (SPDX identifiers); Dependabot alerts and security updates act after a vulnerable dependency is already merged, and version updates only keep packages current. First-party code (SAST): CodeQL code scanning on pull requests and on the default branch. IaC: Defender for Cloud agentless code scanning or the Microsoft Security DevOps extension or action. In a question, decide first whether the control must block a pull request, block a push, or only report, then pick the tool that acts at that point.

Source: Configuring the dependency review action; About GitHub Advanced Security

How are GitHub Advanced Security products split and billed on GitHub and Azure DevOps?

Advanced Security is sold as two products on both platforms. GitHub Secret Protection includes push protection, secret scanning alerts and security overview. GitHub Code Security includes dependency alerts, CodeQL code scanning and findings from third-party tools. In Azure DevOps you enable each product per repository, project or organization and select Begin billing; Enable all covers existing repositories only, and Automatically enable for new repositories or projects is a separate setting. Billing counts each active committer (someone with a push in the last 90 days) to at least one enabled repository once per product within the same Azure subscription, so committers shared by two repositories count once. On GitHub, Copilot Autofix is on by default for repositories that use CodeQL and, for private repositories, needs Code Security, not Copilot seats. In Azure DevOps, Copilot Autofix is in public preview: it proposes a fix as a pull request for code scanning and dependency alerts, not for secret alerts.

Source: Configure GitHub Advanced Security for Azure DevOps; Advanced Security billing

How do I set up CodeQL and dependency scanning in Azure DevOps and block risky pull requests?

Code scanning default setup needs no pipeline changes: it runs weekly on Azure Pipelines with an organization-wide agent pool and schedule, queues an initial scan when enabled, and covers C#, C/C++, Java, JavaScript/TypeScript, Python, Ruby and Rust. Go and Swift need advanced setup with AdvancedSecurity-Codeql-Init@1 (set languages) and AdvancedSecurity-Codeql-Analyze@1. Self-hosted agents need the CodeQL bundle in the tool cache; enableAutomaticCodeQLInstall: true installs it. Dependency scanning uses AdvancedSecurity-Dependency-Scanning@1, or the repository setting Scan for vulnerable dependencies injects it into pipelines that target the default branch. Disabling Marketplace tasks breaks both. To block merges, add a status check branch policy: AdvancedSecurity/AllHighAndCritical requires every existing critical and high alert to be fixed, while AdvancedSecurity/NewHighAndCritical blocks only new ones and needs a build validation pipeline that scans the PR branch.

Source: Code scanning for GitHub Advanced Security for Azure DevOps; Configure GitHub Advanced Security for Azure DevOps

How does secret push protection work, and how is a false positive bypassed on each platform?

On GitHub, push protection for repositories requires GitHub Secret Protection and is off by default. It blocks partner patterns, generic patterns when enabled, and custom patterns with push protection turned on, across command-line pushes, web commits, file uploads and REST API requests. By default anyone with write access can bypass with a reason: It's used in tests and It's a false positive create closed alerts, I'll fix it later creates an open alert, and every bypass goes to the audit log. Delegated bypass makes contributors request approval instead. Push protection for users is on by default and covers pushes to public repositories. In Azure DevOps, enabling Secret Protection turns on push protection and repository scanning; push protection checks only new pushes, while repository scanning finds secrets in history. A confirmed false positive is pushed with skip-secret-scanning:true in the commit message, and an alert is still created so the bypass can be audited.

Source: Push protection; Secret scanning for GitHub Advanced Security for Azure DevOps

What permissions and steps connect Azure DevOps, GitHub and GitLab to Defender for Cloud?

Create connectors in Defender for Cloud > Environment settings > Add environment. For Azure DevOps you need Contributor on the subscription, Project Collection Administrator on each organization and the Basic or Basic + Test Plans access level (Stakeholder isn't enough), and Third-party application access via OAuth must be On in each organization. Defender acts as the identity that authorized the connector, so Microsoft recommends a dedicated service account. For GitHub you need Contributor on the subscription and Organization Owner, and you install the Defender for Cloud GitHub app on the organizations to onboard. GitLab needs Group Owner. Each organization can be onboarded once per tenant, and resources can take up to 8 hours to appear. For read-only access to DevOps findings, assign Security Reader at the resource group or connector scope instead of broad subscription roles; Security Admin and Contributor can change settings.

Source: Connect Azure DevOps environments to Defender for Cloud; Quick Start: Connect your GitHub Environment to Microsoft Defender for Cloud

What do agentless code scanning and pull request annotations in Defender for Cloud require?

Agentless code scanning (preview) runs through the Azure DevOps and GitHub connectors and scans each repository's default branch with no pipeline or workflow changes. It reports code vulnerabilities, open-source dependency vulnerabilities and IaC misconfigurations (including Bicep, ARM, Terraform, Kubernetes, Helm and Dockerfiles) and builds an SBOM, using Template Analyzer, Checkov, Bandit, ESLint, Trivy and Syft. Repositories are discovered every eight hours, scans run daily, and repositories must be under 1 GB. Pull request annotations are a Defender CSPM capability. In Azure DevOps they need Contributor or Owner on the subscription, the Microsoft Security DevOps extension and a Build Validation policy for the CI build on the target branch; you then turn them on under DevOps security > Manage resources. Only IaC findings are annotated. In GitHub, annotations require GitHub Advanced Security and the Microsoft Security DevOps action. GitLab merge requests get no annotations.

Source: Support and prerequisites: DevOps security; Enable pull request annotations in GitHub and Azure DevOps

Traps in 4.3 questions

  • AdvancedSecurity/AllHighAndCritical blocks every pull request while an existing backlog remains; to stop only newly introduced issues use AdvancedSecurity/NewHighAndCritical.
  • Default setup in Azure DevOps doesn't scan Go or Swift; those need advanced setup with the CodeQL tasks, and self-hosted agents need enableAutomaticCodeQLInstall or a cached bundle.
  • Project Administrator in every project does not replace Project Collection Administrator for the Defender for Cloud Azure DevOps connector, and Stakeholder access is not enough.
  • Dismissing an alert does not unblock a push; in Azure DevOps a false positive is pushed with skip-secret-scanning:true, and on GitHub the pusher selects a bypass reason.

10 questions in the bank test task 4.3. Practice Domain 4

GitHub Advanced Security for Azure DevOps dependency scanning alerts list with scope and EPSS percentile filters
Dependency scanning alerts in GitHub Advanced Security for Azure DevOps. Source: Microsoft Learn (CC BY 4.0).

Free Domain 4 questions

Question 1, Domain 4, skill 4.1.3

A GitHub Actions workflow must deploy to Azure without storing a client secret. The Microsoft Entra app registration has a federated credential that matches the workflow, and the repository secrets AZURE_CLIENT_ID, AZURE_TENANT_ID, and AZURE_SUBSCRIPTION_ID exist. The azure/login step fails because the job can't request an OIDC token. What should you change?

on:
  push:
    branches: [main]
permissions:
  contents: read
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: azure/login@v2
        with:
          client-id: ${{ secrets.AZURE_CLIENT_ID }}
          tenant-id: ${{ secrets.AZURE_TENANT_ID }}
          subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
  1. Add a creds input that contains the service principal JSON from a repository secret.
  2. Change contents: read to contents: write so that the token can be exchanged.
  3. Add id-token: write to the workflow-level permissions block.
  4. Add actions: write to the permissions block so the job can reach the OIDC provider.
Show answer and explanation

Answer: C. A job needs id-token: write so that GitHub's OIDC provider issues a JSON Web Token that azure/login exchanges for an Azure access token. Because the workflow declares permissions, every permission it doesn't list is none, so id-token must be added explicitly; it doesn't grant write access to any resource.

Why the other options are wrong:

  • A. A creds JSON contains a client secret, which violates the no-secret requirement.
  • B. contents controls repository contents and has nothing to do with requesting an OIDC token.
  • D. actions controls workflow runs; only id-token: write allows the job to fetch an OIDC token.

Documentation: Configuring OpenID Connect in Azure; Workflow syntax for GitHub Actions

Question 2, Domain 4, skill 4.1.1

Contoso, Ltd. runs an Azure Functions app named func-orders that reads blobs from a storage account named stinvoices. The security team requires that no credential for this access be stored in code, app settings, or Azure Key Vault. The identity must be usable only by func-orders, and it must be removed automatically if func-orders is deleted. You need to configure authentication with the least administrative effort. What should you use?

  1. A user-assigned managed identity that is assigned to func-orders and granted Storage Blob Data Reader
  2. An app registration whose certificate is kept in Key Vault and loaded through a Key Vault reference
  3. An app registration that has a client secret stored as an encrypted application setting
  4. A system-assigned managed identity on func-orders that is granted Storage Blob Data Reader
Show answer and explanation

Answer: D. A system-assigned managed identity is created as part of the Azure resource, only that resource can use it to request tokens, and Azure deletes its service principal when the resource is deleted. Azure manages the credential, so nothing is stored, and you only enable the identity and add one role assignment.

Why the other options are wrong:

  • A. A user-assigned identity has an independent lifecycle, must be deleted explicitly, and can be attached to other resources, which breaks two of the requirements.
  • B. The certificate is a stored credential in Key Vault that you must rotate, which the security team prohibits.
  • C. A client secret in an app setting is a stored credential and adds rotation work.

Documentation: What is managed identities for Azure resources?

Question 3, Domain 4, skill 4.1.2

Your GitHub organization sets the default GITHUB_TOKEN workflow permissions to the restricted setting. A repository contains the following workflow. The job must check out the code, run a script, and open an issue that lists stale dependencies. You need to replace the comment with a permissions block that grants the least privilege that lets the job succeed. What should you use?

name: stale-deps
on:
  schedule:
    - cron: '0 2 * * *'
jobs:
  report:
    runs-on: ubuntu-latest
    # permissions block goes here
    steps:
      - uses: actions/checkout@v5
      - run: ./scripts/find-stale.sh > report.md
      - run: gh issue create --title "Stale dependencies" --body-file report.md
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  1. permissions: { issues: write }
  2. permissions: { contents: read, issues: write }
  3. permissions: { contents: write, issues: write }
  4. permissions: { contents: read, pull-requests: write }
Show answer and explanation

Answer: B. When a permissions block lists any permission, every permission that isn't listed is set to none. The checkout step needs contents: read, and gh issue create needs issues: write, so both must be listed and nothing more.

Why the other options are wrong:

  • A. Listing only issues sets contents to none, so actions/checkout can't read the repository.
  • C. contents: write lets the job push commits and create releases, which is more than the job needs.
  • D. pull-requests: write doesn't allow creating issues, so gh issue create fails.

Documentation: Workflow syntax for GitHub Actions; Use GITHUB_TOKEN for authentication in workflows

Question 4, Domain 4, skill 4.1.5

Contoso has an Azure DevOps organization that contains only private projects. You need to assign access levels at the lowest cost. Sixty business owners must view and edit work items and approve releases but never open code. Six QA leads must create test plans and test suites and author manual test cases. None of these users has a Visual Studio subscription or GitHub Enterprise license. Which two assignments should you make? Each correct answer presents part of the solution. (Choose TWO.)

Choose TWO.

  1. Business owners: Stakeholder
  2. Business owners: Basic
  3. QA leads: Basic
  4. QA leads: Basic + Test Plans
  5. QA leads: Stakeholder
Show answer and explanation

Answer: A and D. Stakeholder access is free for unlimited users and covers creating and editing work items and viewing and approving release pipelines, but not Azure Repos. Creating test plans and suites and authoring manual test cases is Test Case Management, which needs Basic + Test Plans or an equivalent Visual Studio subscription.

Why the other options are wrong:

  • B. Basic is a paid level, and these users don't need code access.
  • C. Basic doesn't include web-based test case management for creating test plans and suites.
  • E. Stakeholders have no access to Azure Test Plans in private projects.

Documentation: About access levels; Stakeholder access quick reference

Question 5, Domain 4, skill 4.2.1

You have an Azure DevOps project named Contoso. Twelve YAML pipelines reference a variable group named prod-secrets that is linked to an Azure key vault named kv-prod. When the security team rotates the value of an existing secret, the pipelines pick up the new value on the next run. Yesterday the team added a new secret named PaymentApiKey to kv-prod, but $(PaymentApiKey) doesn't resolve in any pipeline run. You need the pipelines to receive the new secret with the LEAST administrative effort. What should you do?

  1. Grant the service connection's identity the List permission on secrets in kv-prod.
  2. Edit the prod-secrets variable group and add PaymentApiKey to its mapped secrets.
  3. Reauthorize the service connection that prod-secrets uses on the Library page.
  4. Add an AzureKeyVault@2 task with SecretsFilter set to '*' to all twelve pipelines.
Show answer and explanation

Answer: B. A Key Vault-linked variable group maps secret names, not values. Value changes to secrets that are already mapped flow through automatically at runtime, but secrets added to or deleted from the vault are not added to the group; you must select them explicitly. Adding PaymentApiKey to the group fixes all twelve pipelines in one place.

Why the other options are wrong:

  • A. Existing secrets already resolve, so the identity clearly has Get and List; permissions aren't the gap.
  • C. The connection already works for the mapped secrets; reauthorizing doesn't add the new secret name to the group.
  • D. This would work but means editing twelve pipelines, which isn't the least effort when one variable group edit is enough.

Documentation: Link a variable group to secrets in Azure Key Vault

Question 6, Domain 4, skill 4.2.4

An Azure Pipelines secret variable named SvcConfig holds a JSON document that contains a service account name and password. A deployment script parses SvcConfig and, on failure, writes the parsed password to the log. Reviewers see the password in clear text even though SvcConfig is marked secret. You need to reduce the chance that such values appear in logs. What should you do?

  1. Store each sensitive value as its own secret variable and map each one to an environment variable.
  2. Turn on the Limit variables that can be set at queue time setting for the project.
  3. Declare SvcConfig in YAML with readonly: true so that scripts can't change its value.
  4. Set System.Debug to false so that the agent doesn't write diagnostic output.
Show answer and explanation

Answer: A. Azure Pipelines masks the exact secret value but never masks substrings. A field taken out of a structured secret, such as JSON, isn't masked. Microsoft advises against storing structured data in secrets; one secret per sensitive value, mapped explicitly into the environment, keeps each value maskable.

Why the other options are wrong:

  • B. This stops users from adding or overriding variables at queue time; it does nothing for log masking.
  • C. Read-only stops changes to the variable, not its contents appearing in logs.
  • D. The script itself writes the value; debug logging isn't the cause.

Documentation: Set secret variables

Question 7, Domain 4, skill 4.3.2

Contoso uses GitHub Advanced Security for Azure DevOps with secret push protection enabled on all Azure Repos repositories. A developer's push is rejected because a unit-test fixture contains a dummy connection string. The team confirms that it isn't a real credential. Policy requires push protection to stay enabled on the repository. What should the developer do?

  1. Include skip-secret-scanning:true in the commit message and push the commit again.
  2. Ask a Project Administrator to dismiss the secret alert, then retry the same push.
  3. Ask a Project Collection Administrator to turn off push protection briefly for the push.
  4. Make the same change in the Azure Repos web editor, which push protection doesn't check.
Show answer and explanation

Answer: A. In Azure DevOps, a developer can bypass a push protection block for a confirmed false positive by putting skip-secret-scanning:true in the commit message. Push protection stays on, and a secret scanning alert is still created after the push, so the bypass can be audited.

Why the other options are wrong:

  • B. A blocked push never reaches the repository, so there's no alert to dismiss, and dismissal doesn't unblock pushes.
  • C. Turning off push protection, even briefly, breaks the policy.
  • D. Push protection also blocks secrets in commits made through the web interface.

Documentation: Secret scanning for GitHub Advanced Security for Azure DevOps

The full bank has 45 more Domain 4 questions and 20-question Domain 4 drills that serve unseen questions first.

Domain 4 drill: $19.99