Exam AZ-400 All QuestionsBrowse all questions from this exam
Question 171

You have a GitHub repository that contains multiple workflows and a secret stored at the environment level.

You need to ensure that the secret can be used by all the workflows.

What should you do first?

    Correct Answer: B

    To ensure that a secret can be used by all workflows in a specific GitHub repository, you should recreate the secret at the repository level. By doing this, the secret will be accessible to all workflows within that repository. Organization-level secrets are used when you want to share a secret across multiple repositories within the same organization, but that is not necessary in this case where the requirement is only for one repository.

Discussion
vsvaidOption: A

I think A is correct https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-an-organization

zellckOption: B

B is the answer. https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository

kay000001Option: B

Answer should be B. Creating secrets at the repository level ensures that it is available to all workflows within that repository.

ghaboolOption: A

I choose A Recreating the secret at the repository level would not make it available to all the workflows, as repository secrets are only accessible within the repository they are defined in

vector_bcoOption: A

all workflows inside the repository already have access to the environment secrets within this repository at the same time if we really need to be able to use secrets in ALL the repositories (within the any repo) we need recreate secrets on a higher level - organization - answer A

catfood

its also possible to enable the approvers/reviewers for each worfklow to access the secret at environment level. The question doesn't give us a motive eg. easiest, most secure....

SkankhuntOption: B

I'm going with B, the question reads "You have A (one) GitHub repo". In this case, recreating it at the Org level would be an "over assignment".

chloausOption: A

For secrets stored at the organization-level, you can use access policies to control which repositories can use organization secrets. Organization-level secrets let you share secrets between multiple repositories, which reduces the need for creating duplicate secrets. Updating an organization secret in one location also ensures that the change takes effect in all repository workflows that use that secret. https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-encrypted-secrets-for-an-organization

ozbonnyOption: B

since the question says all workflows but doesn't specify organization I infer that it is related to the repository B. Recreate the secret at the repository level.