# AZ-401: Protected Deployment Environments and Approvals

Configure owner-controlled Azure resource checks and GitHub environment protection, then verify reviewers, branch restrictions, secret timing, expiry and administrative bypass.

Author: LearningPathX Editorial Team
Content version: 1.0
Published: 2026-12-04T03:36:54.447059+00:00
HTML: https://learningpathx.com/guide/AZ-401/az-401-protected-deployment-environments-and-approvals.html

## AZ-401: Protected Deployment Environments and Approvals

Resource owners enforce deployment approval by configuring checks on the resource or environment that a pipeline actually consumes, then verifying the resulting admission decision with the real actor and run. In Azure Pipelines, resource-owner approvals and checks sit outside the author's pipeline definition. In GitHub Actions, a job must reference the intended environment and satisfy its available protection rules before it is sent to a runner. A successful test or an author-written condition does not establish either approval.

This procedure configures both models on existing owned nonproduction test resources. It includes pending, denied, timeout and bypass observations without treating the platforms as equivalent. No deployment, approval, policy change or test run was performed for this explanation.

## Define the authority boundary and starting state

Use an existing validated pipeline/workflow and harmless admission marker rather than a real production deployment. Keep the resource owner, pipeline author, designated reviewer and privileged administrator identities explicit. They may overlap in a real organization, but that overlap changes what an independence test can demonstrate.

Record:

* The exact Azure project, consumed protected resource, test pipeline/stage and resource owner.
* The GitHub repository, plan, visibility, existing test environment and job that references it.
* Permitted branches/tags, an existing disallowed test reference, reviewers and intended self-approval behavior.
* The actual ordinary actor, unauthorized review actor and privileged actor for each test.
* Existing checks, permissions, branch restrictions, bypass settings and any environment-secret consumer.
* The owner-approved Azure approval timeout and the observation/cancellation window for pending test runs.
* The settings to restore, settings to retain and person responsible for each action.

Confirm actual effective permissions and inherited access. An access level, a role label or membership in a team is not a substitute for checking who can edit the resource controls and who can approve or bypass them.

Never weaken a shared production policy to make a demonstration succeed. If a feature or permission needed for the test is unavailable, record the missing prerequisite and stop that operation.

## Configure Azure checks on the consumed resource

For the worked Azure path, use an existing test environment already consumed by a bounded stage in the owner's validated pipeline. Confirm that relationship from the actual pipeline and run resources. Merely creating an environment with a familiar name does not attach its checks to an unrelated stage.

The resource administrator performs the configuration through Azure Pipelines:

1. In the project, open Pipelines, Environments and the selected existing environment.
2. Open Approvals and checks, choose the add control, then Approvals and Next.
3. Add the designated users or groups, record the review instructions, restrict self-approval for this exercise and set the agreed Timeout.
4. Create the check, reopen it and inspect the saved reviewer, self-approval and timeout values.
5. On that same resource, add a Branch control check. Enter the actual fully qualified allowed branch references, beginning with `refs/heads/`, and configure the intended protection requirement and unknown-protection behavior.
6. Reopen the saved branch check and compare it with the approved branch record.

A required-reviewer group does not imply approval by every member: the documented Azure behavior allows one member of the designated group to approve. The reviewer list is fixed when checks start, so changing it while a run is waiting does not redefine that run's approvers.

Branch control examines the linked resources' actual source branches. A protection-status result is not proof that every desired merge-review or quality requirement was executed. Keep repository protection and deployment admission evidence distinct.

Resource owners control these checks outside pipeline YAML. A pipeline author editing a condition cannot edit the resource's check through that definition. However, a stage that does not consume the protected resource has not tested this boundary at all.

## Verify Azure pending, denied and expired runs

Use the ordinary pipeline actor first. Confirm that the stage's own conditions permit it to reach the resource checks and that the run started after the checks were added. Otherwise, a skipped condition can masquerade as a successful deployment guard.

For separate harmless runs, record the pipeline revision, resource, actor, source reference, saved check settings and actual Checks panel evidence:

| Case | Required observation |
| --- | --- |
| Allowed source, approval missing | The consuming stage waits for its resource checks; the protected work has not started |
| Actor outside the designated reviewer set attempts approval | The actor cannot satisfy the approval; preserve actual permission evidence |
| Designated reviewer rejects approval | The terminal rejection prevents stage execution |
| Approval remains incomplete until the configured Timeout | The approval expires and the documented approval outcome marks the stage skipped |
| Designated reviewer approves an allowed run | The stage can proceed only when all remaining checks on all consumed resources are satisfied |
| Disallowed source branch | Branch control rejects the actual run reference and the stage does not proceed |

Do not label every non-started run a timeout. Distinguish an author condition, branch rejection, missing approval, expired approval and another resource's outstanding check.

For a permitted run, verify the actual harmless marker or owned operation after admission. An approval notification alone does not prove that execution reached the intended resource.

### Inspect the administrative bypass path separately

An Azure resource administrator can bypass the documented supported check types, including approval, while the resource is waiting for review. This is an explicit privileged exception, not the ordinary review path.

Only if the owner authorizes the test on this disposable resource, use Bypass check for the pending approval and inspect the Checks panel's recorded bypass actor. Keep other resource checks and branch restrictions intact. Do not infer that this permits bypassing every check type.

If no bypass operation is authorized, retain the effective administrator-permission evidence and state that execution was not tested. An ordinary actor's rejection cannot establish the absence of an administrator route. Record who can administer the resource as part of the deployment-authority handoff.

## Establish GitHub feature eligibility before configuration

Select an existing owner-controlled test environment in a repository with the required features. GitHub Free, Pro and Team plans provide required reviewers only for public repositories. Environment-secret and branch-restriction availability also depends on plan and visibility. On GitHub Free, environment secrets are limited to public repositories; private/internal use requires Pro, Team or Enterprise. That secret availability does not imply required-reviewer availability. A private repository's environment name does not prove that its required-reviewer control is available.

Check the actual environment editor and the documented conditions before promising the outcome. If the repository cannot provide the required protection, stop instead of replacing it with an author-written job condition and calling that equivalent approval.

In the existing test environment's protection settings:

1. Configure the intended Required reviewers using actual eligible users or teams. They need at least repository read access.
2. Enable prevention of self-review for the exercise. A deployment initiator must not approve their own deployment even when listed as a reviewer.
3. Set Deployment branches and tags to the intended selected references/patterns. Configure branch and tag rules separately and verify the actual run reference against them.
4. Inspect the administrator-bypass control. Where available and intended, disallow bypassing the configured protection rules.
5. Save through the actual editor and reopen each setting to verify the resulting state.

GitHub allows up to six users or teams in the reviewer list, but one required reviewer's approval is enough for the job to proceed. Do not describe a list of six as six mandatory approvals.

The Protected branches only option has an important exception: if the repository has no branch protection rules, all branches can deploy under that option. For the bounded exercise, explicit selected branch/tag rules make the intended allowed and denied cases easier to inspect. Wildcard matching does not automatically cross a path separator.

Repository branch protection remains a separate layer. It can govern merging into a branch; an environment rule governs a job's access to that environment. Neither should be used as unexplained evidence for the other.

## Bind the actual GitHub job to that environment

Use an owned workflow and the actual eligible test environment. The following complete admission probe accepts an environment selection and performs only a harmless marker after job admission. It requests no repository token permissions and does not check out code, use a secret or deploy an application:

```yaml
name: Environment admission probe

on:
  workflow_dispatch:
    inputs:
      target:
        description: Select the owned test environment
        type: environment
        required: true

permissions: {}

jobs:
  probe:
    runs-on: ubuntu-latest
    environment: ${{ inputs.target }}
    steps:
      - name: Record admitted execution
        run: printf '%s\n' 'Job admitted'
```

Before dispatch, inspect the selected environment's saved controls and use only the agreed test target. A selection field does not validate policy, feature eligibility or ownership. Confirm the actual event/reference and runner availability in the repository's supported workflow context.

GitHub requires the referenced environment's deployment protection rules to pass before sending the job to a runner. An environment name in a comment, an unused input or a different job is not the binding. Confirm the actual job's environment selection in the run evidence.

This probe establishes admission evidence only. It does not validate a deployment or prove secret consumption. Keep those claims out of its result.

## Verify GitHub review, reference and secret timing

Run the harmless probe under the agreed ordinary actor and allowed test reference. Observe the waiting job before any approval, then use separate authorized runs for the negative and positive cases:

* The configured reviewer has not approved: the environment-bound job remains waiting.
* The initiating user is also a listed reviewer with self-review prevented: they cannot satisfy that job's review.
* An unlisted actor tries to satisfy the required review: their unrelated repository access is not a substitute for the configured review.
* A run uses the recorded disallowed branch/tag: environment admission is denied by the actual reference rule.
* An eligible designated reviewer approves an allowed run: the job can be dispatched after its remaining protections pass, and its harmless marker becomes observable.

Retain the actual reviewer, initiating actor, run reference, environment and configuration with the result. A marker by itself is not proof of a reviewer gate if the job selected an unprotected environment.

Environment secrets are available only to jobs referencing that environment. Where approval is required, the job cannot access those secrets until a required reviewer approves. Inspect this timing through the actual pending/admitted job boundary without printing a secret. An existing approved secret consumer, if separately tested, needs its own non-disclosing evidence.

An environment is not runner isolation. In particular, using an environment does not put self-hosted workflow execution into an isolated container. Keep the execution host, untrusted inputs, token privileges and secret exposure within their own approved trust boundaries.

### Do not import Azure timeout semantics

A GitHub wait timer delays admission; it is not the Azure approval Timeout setting. Do not invent a matching approval deadline or claim that the platforms produce the same terminal state.

Use the actual platform-reported result if a documented applicable limit is reached. Otherwise, when the agreed observation window ends, cancel only the owned pending run and record cancellation accurately. That is a bounded pending/cancellation observation, not an executed approval-timeout test. The Azure expiry case above supplies its own separately observed timeout evidence.

### Verify configured administrator bypass

GitHub administrators can bypass environment protection by default where that feature applies, and environments can be configured to disallow bypass. Inspect the actual eligible setting and test the intended privileged behavior on the owned environment.

For a disallow-bypass policy, verify that the administrator cannot force the waiting job through that route. If the owner deliberately retains a bypass exception, record the setting, actor and actual bypass evidence separately from ordinary reviewer approval. Do not enable bypass on a shared environment merely to finish the test.

Do not equate GitHub's configured administrator control with Azure's resource-administrator exception. Each needs its own actor, saved configuration and observed path.

## Diagnose a guard that never actually ran

Before changing any control, establish:

1. The exact stage/job, target resource or environment, source reference and actor.
2. Whether the pipeline actually consumed the protected Azure resource or the GitHub job actually referenced the protected environment.
3. Whether author conditions or dependencies prevented the run from reaching that boundary.
4. Which review, branch restriction or other check was pending, rejected, expired or bypassed.
5. Whether the observed behavior came from an ordinary actor or an administrative exception.

Preserve the decisive evidence before a repair. Do not fix a disallowed source by removing a shared branch rule, a missing reviewer by granting broad administration, or an unavailable plan feature by renaming a job condition.

Quality thresholds and deployment authority are different acceptance decisions. A complete test report cannot approve a resource-owner decision, and an approved environment does not establish application correctness or safe traffic exposure.

## Restore only the owned exercise changes

Compare the final configuration with the recorded baseline. Through the respective owners, restore only the temporary reviewer entries, branch/tag rules, self-review/bypass choices, timeouts, pipeline bindings and permission edges introduced for this exercise. Preserve shared controls and unrelated actor grants.

Close or cancel owned test runs as agreed, then recheck the intended retained policy. Record any setting the owner chose to keep instead of calling it restored.

Keep configuration snapshots and the pending/denied/approved/expired/bypassed evidence together. Record untested paths and their exact limitations. The result should let another operator explain who can authorize which deployment and why a particular run did or did not cross the boundary.

## Authoritative Sources

* [Define approvals and checks](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops) — Consumed-resource checks, approval configuration, branch control, timeout and documented administrative bypass.
* [Deployments and environments](https://docs.github.com/en/actions/reference/workflows-and-actions/deployments-and-environments) — Reviewer and reference rules, eligibility, secrets timing and environment bypass behavior.
* [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax) — Environment input/job binding, permissions and protection before runner dispatch.
* [About protected branches](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches) — Repository merge protection as a separate control layer.
* [About permissions and security groups](https://learn.microsoft.com/en-us/azure/devops/organizations/security/about-permissions?view=azure-devops) — Azure DevOps effective permissions and object scopes.
* [Secure use reference](https://docs.github.com/en/actions/reference/security/secure-use) — Secret handling, untrusted execution and runner precautions.

## Related Reading

* Prerequisite: [AZ-401: Project Repository and Team Access Boundaries](https://learningpathx.com/guide/az-401/az-401-project-repository-and-team-access-boundaries.html)
* Prerequisite: [AZ-401: YAML Triggers Job Dependencies and Parallel Execution](https://learningpathx.com/guide/az-401/az-401-yaml-triggers-job-dependencies-and-parallel-execution.html)
* Related: [AZ-401: Tests Published Results and Enforced Quality Gates](https://learningpathx.com/guide/az-401/az-401-tests-published-results-and-enforced-quality-gates.html)
* Related: [AZ-401: Progressive Delivery and Deployment Slot Decisions](https://learningpathx.com/guide/az-401/az-401-progressive-delivery-and-deployment-slot-decisions.html)
