PUBLIC BETA OFFER

Save 50% off on an Eligible Learning PlanValid for 1-month plan, 3-month plan, 12-month plan · Code LPXBETA50 · Ends Dec 6, 2026

AZ-401: Secrets Keys Certificates and Sensitive Deployment Assets

Create a scoped GitHub secret and authorize Secure Files key and certificate downloads, test denied access and re-upload replacement, and separate storage cleanup from credential revocation.

Guide

Content version 1.0

AZ-401: Secrets Keys Certificates and Sensitive Deployment Assets

AZ-401: Secrets Keys Certificates and Sensitive Deployment Assets

Configure deployment assets by separating storage, access authorization and actual consumer use. For GitHub Actions, create a secret in the intended scope and reference it without displaying its value. For Azure DevOps Services Secure Files, upload the existing valid files, configure Library/item security and explicitly authorize the selected YAML Ain't Markup Language (YAML) pipeline before downloading them.

Replacement is a lifecycle operation, not an in-place file edit: Azure Secure Files requires controlled deletion and re-upload, followed by reference and authorization checks. Deleting stored material does not revoke a credential or change a certificate's validity. The following nonproduction procedure includes permitted and denied cases, replacement and owned cleanup; it reports no live secret or pipeline operations.

Establish the asset and consumer boundary

Use the project and repository access established through AZ-401: Project Repository and Team Access Boundaries. Have the owners identify:

  • One approved GitHub repository, secret scope and trusted manual workflow.
  • One Azure DevOps Services project, selected existing YAML pipeline and permitted Library administrator.
  • A valid pre-existing exportable test private-key file and certificate file, plus a valid approved replacement file.
  • The actual consumers and their supported file formats, protected inputs, runtime permissions and nonsensitive success/failure evidence.
  • The original security assignments, pipeline permissions, references and settings to restore.

The owner must already have validated the files for the intended test, including any required key/certificate relationship and passphrase handling. A filename or extension is not proof of cryptographic validity. Stop if the required files or consumer are unavailable; do not generate a key, issue a certificate or export a nonexportable object to fill the gap.

Choose storage according to the asset:

Asset or requirement Boundary to preserve
A GitHub Actions secret value Repository, environment or organization scope determines where it can be supplied
An exportable key or certificate file needed by an Azure pipeline task Secure Files protects stored files, with Library/item security and pipeline controls
A Key Vault secret, key or certificate object The vault consumer requires the owner's granted permissions
A hardware security module (HSM)-backed key That service has different object and operation boundaries from an uploaded file

Azure Key Vault supports keys, secrets and certificates; Azure Key Vault Managed HSM supports HSM-backed keys. Neither is an instruction to extract a protected key into a pipeline file. Keep the existing object owner and consumer permissions distinct.

Create and reference one scoped GitHub secret

Choose the scope and record its policy

For this worked route, use a repository secret in the approved sandbox. In an organization repository, the creator needs write access; in a personal repository, the documented requirement is repository-collaborator access.

Environment secrets have different administration requirements: the repository owner for a personal repository, or admin access for an organization repository. Organization owners can create organization secrets and restrict repository access. Organization-level secrets are not available to private repositories on GitHub Free.

Record the intended scope, name and permitted repository/workflow before entering a value. Avoid an ambiguous exercise name already used in another available scope.

Create the secret through its supported interface

Open the repository's Settings, then Secrets and variables under Security, and Actions. In the Secrets tab, select New repository secret. Enter an exercise name such as DEPLOYMENT_TEST_SECRET, supply the approved nonproduction value through the protected field and add the secret.

Confirm the listed name and intended scope without recording the value. A listed secret name is not proof that every event or workflow receives it.

Use the documented secrets context in the existing trusted workflow. This availability probe passes the secret through an environment variable and prints only a fixed result:

steps:
  - name: Check scoped test secret availability
    shell: bash
    env:
      DEPLOYMENT_TEST_SECRET: ${{ secrets.DEPLOYMENT_TEST_SECRET }}
    run: |
      if [ -z "$DEPLOYMENT_TEST_SECRET" ]; then
        printf '%s\n' 'Required test secret is unavailable.'
        exit 1
      fi
      printf '%s\n' 'Required test secret is available.'

Adapt the secret name to the actual created item and retain the workflow's approved runner and trigger settings. Do not add tracing, print the environment or echo the value.

An unset secret expression evaluates to an empty string. In a separate owned negative case, reference a confirmed nonexistent exercise name and expect the availability check to fail. That tests delivery/name handling; it does not prove external service authentication.

Check policy restrictions separately. Except for GITHUB_TOKEN, secrets are not passed to workflows triggered from forks; they are not available to Dependabot-triggered workflows and are not automatically passed to reusable workflows. Do not weaken those boundaries or run untrusted code merely to make a test succeed.

For a real consuming step, use its existing supported protected input rather than placing the secret on a command line or inventing a client command. Record only its nonsensitive actual result. Automatic masking is not a guarantee that a transformed or accidentally printed secret will be concealed.

Upload the existing key and certificate files

Verify prerequisites and upload both assets

Each Azure Secure File must be no larger than 10 MB. The documented download-task minimum is agent version 2.182.1; use an actually supported compatible agent meeting that requirement. Also verify the project's secure-file/pipeline-resource settings and the operator's permission to add Library items.

The documented prerequisites identify Project Administrator, Contributor or a suitable custom role for Library-item management, while managing Library security requires Project Administrator or equivalent permission. Do not treat the ability to upload an item as proof of authority to change its security.

In the selected project:

  1. Open Pipelines, then Library, and select Secure files.
  2. Select the secure-file upload control, choose the approved test key file and confirm the upload.
  3. Verify the new item appears in the list.
  4. Repeat for the approved certificate file.
  5. Record the actual item identifiers/names, owner, intended consumer and approved source-file record without exposing file contents.

Illustrative item names below are az401-test-key.key and az401-test-certificate.crt. Use the real uploaded names; these names do not establish a file format or validity.

Configure Library/item security and YAML authorization

Inspect Library Security and record the actual users, role labels, scope and existing assignments. Then open each uploaded file and its Security view. Have the permitted administrator apply the minimum actual supported item-role assignment for the intended consumer and management actors, preserving unrelated assignments.

Record the selected role's actual label and permitted operations from that interface. Do not invent a universal role map or assume a broad project membership supplies every required item permission.

For each file, open Pipeline permissions, select the add control and authorize only the selected existing YAML pipeline. Verify its actual definition is listed. Do not choose Open access on a shared project.

These are separate controls: a user's Library/item role is not the selected YAML pipeline's authorization. Azure's Secure Files documentation also states that all Classic pipelines can access secure files. Do not generalize this YAML allowlist into a Classic isolation guarantee; the actual Library security, trusted consumers and applicable resource controls still matter.

Consume through the documented download task

Add a named DownloadSecureFile task for each authorized item in the agreed existing YAML job:

steps:
  - task: DownloadSecureFile@1
    name: testKey
    displayName: Download owned test key
    inputs:
      secureFile: 'az401-test-key.key'

  - task: DownloadSecureFile@1
    name: testCertificate
    displayName: Download owned test certificate
    inputs:
      secureFile: 'az401-test-certificate.crt'

Use the actual uploaded names and retain the pipeline's approved execution settings. The named outputs $(testKey.secureFilePath) and $(testCertificate.secureFilePath) supply paths for the existing consumer's documented file-path inputs.

Do not print, concatenate or publish the files. In particular, do not copy a public-certificate sample's broad-readable permissions onto a private key. The consuming process and its account must have the restricted access actually required for the approved use, with no grant to all users.

Inspect the download-task results and the consumer's nonsensitive evidence separately. A successful download establishes retrieval, not key/certificate validity or successful authentication by a downstream service. Use the existing owner-validated consumer; this exercise supplies no invented signing, import or cryptographic command.

Prevent the consumer from placing private material in artifacts, caches or diagnostics. Use its reviewed cleanup for owned temporary copies. Do not assume encrypted server storage makes an untrusted execution host safe.

Verify allowed and denied cases

Run only authorized nonproduction tests and record the actual definition revision, actor, item, policy and result.

Case Expected observation What it distinguishes
Selected authorized YAML pipeline and permitted item access Both downloads and the approved consumer can complete if all other prerequisites hold Retrieval and consumer evidence, rather than upload alone
A separate approved test YAML pipeline not authorized for the item Secure-file use is rejected before successful consumption Pipeline authorization, not a fabricated bad key
An actor without the required management permission The attempted Library/item management operation is denied User-role authority, not pipeline use
Wrong or missing exercise file reference Retrieval fails or the reference cannot resolve Naming/item identity, not credential revocation
Valid retrieval but invalid consumer result Consumer reports its actual failure without content disclosure File/format/credential use, separate from storage access

Use an existing approved negative-test definition and actor. Do not remove a shared consumer's access or deliberately expose a secret to create a failure. If another grant or Open access makes the supposedly unauthorized case succeed, investigate the effective configuration before claiming the boundary worked.

These are expected outcomes, not observed results. Record the real diagnostic; a busy agent, unsupported task environment or unrelated pipeline error is not evidence of an authorization denial. Stop if a required case cannot be exercised safely with the approved inputs.

Self-hosted GitHub runners also need adequate resources and connectivity; labels/groups route work but do not make untrusted code safe. Docker container actions and service containers on self-hosted runners require Linux with Docker installed. Do not add a second runner or container lab to this asset-handling exercise.

Replace by controlled deletion and re-upload

Secure Files does not support editing or replacing uploaded contents in place. Plan a bounded replacement of one exercise item, such as an owner-validated replacement certificate suitable for the existing test key and consumer.

  1. Stop new exercise consumption and coordinate any active work with its owner.
  2. Retain the approved original/replacement source files through the owner's protected recovery process. Record current item identity, security, authorized pipelines and references.
  3. Delete only the selected exercise item through Secure Files, then upload the approved replacement.
  4. Inspect the new listed item and reconcile its actual name/identity with every affected reference. A reused filename is not proof that the former item or authorization remained.
  5. Inspect and re-establish the required Library/item permissions and individual YAML-pipeline authorization as necessary.
  6. Repeat the permitted and unauthorized-pipeline cases, then the actual consumer check, without revealing contents.

If the filename changes, update the affected references. Even with the same name, recheck actual resolution, permissions and authorization. A successful upload alone is not a completed rotation or a successful consumer test.

Deleting a private-key file does not revoke its credential, and deleting a certificate copy does not change issuer-side validity or revocation. Handle any required credential rotation or incident action with the responsible authority. AZ-401: Sensitive Data Removal and Git History Coordination covers the separate incident-response boundary.

Keep Key Vault mapping and cleanup precise

A Key Vault-linked variable group maps selected secret names, then obtains current values at runtime. Existing value changes can be available through that mapping, but added or deleted names require explicit mapping updates. This integration does not map Key Vault keys or certificates.

That distinction does not turn a vault owner into every consumer, or make every connector/network configuration supported. Retain the actual existing connection and granted permissions; AZ-401: Key Vault Integration with Azure Pipelines and GitHub Actions develops the retrieval configuration. No vault, HSM export or variable-group consumer recipe is added here.

For final cleanup, cancel pending exercise runs and finish approved active consumption. Remove only the created GitHub secret, the owned Secure Files items and their temporary access/reference changes. Verify the selected names/items are absent and original settings restored; preserve unrelated assets and security assignments.

Use the reviewed consumer cleanup for local temporary copies and protected credential records. Keep only nonsensitive identifiers, policy changes, actual test results and restoration evidence. A storage-deletion record never substitutes for a credential-revocation record.

Authoritative Sources

0 views