Try a sample question
This is an original sample question written by itmoshi based on the exam objectives.
An organization on GitHub Enterprise Cloud has a private repository whose workflow includes a deploy job that deploys to production using production cloud credentials; it is the only job configured to reference the production environment. Requirements: the credentials must be readable only by jobs that reference the production environment (that is, the deploy job); the deploy job must run only after a release manager approves it, and under the configured rules administrators must not be able to bypass approval of a pending deployment; and the repository's test workflows, which do not reference production, must not be able to read the credentials. How should you configure this?
- AStore the credentials as a repository secret and reference them from the deploy job through the secrets context
- BStore the credentials as an organization secret and limit repository access to this repository only
- CBase64-encode the credentials and put them in the workflow file's env block as job environment variables
- DStore an environment secret in production, make release managers required reviewers, and disallow admin bypass
Show answer and explanation
Answer:D Use environment secrets with environment protection rules to limit secrets to specific jobs and require approval.
Why it is correct
A secret stored in an environment can only be read by jobs that reference that environment. Setting environment: production on the deploy job, and not on test jobs, keeps the secret out of the test workflows. Making the release managers required reviewers in the environment's protection rules means the job does not start, and does not receive the secret, until one of them approves. Turning off "Allow administrators to bypass configured protection rules" stops administrators from bypassing approval of a pending deployment (administrators can still edit the rules themselves, which needs separate control).
The other options
- ✗ A A repository secret can also be referenced by the repository's test workflows, and there is no approval step. It suits low-impact values used by many jobs in a repository.
- ✗ B Organization secrets can only be scoped down to repositories, so the repository's test workflows can still reference them, and there is no approval. Use them to share one value across many repositories.
- ✗ C Base64 is encoding, not encryption: anyone who can read the workflow file can decode it, and a value placed in env is not automatically masked in logs the way a secret is. This is only a way to pass non-sensitive settings inside a workflow.
Key takeaway
Secret scope: organization → shared across repositories; repository → available to that repository's workflows; environment → only jobs that reference that environment. Approvals, wait timers and deployment branch limits → environment protection rules, including whether administrators may bypass them.
Try 20 questions like this for free
itmoshi is an unofficial study service and is not affiliated with Microsoft or any exam provider.