nerdexam
MicrosoftMicrosoft

AZ-400 · Question #611

AZ-400 Question #611: Real Exam Question with Answer & Explanation

This question tests knowledge of GitHub Actions workflow syntax for accessing organizational secrets and executing PowerShell scripts within a job step.

Submitted by lukas.cz· Mar 6, 2026

Question

Hotspot Question You have a GitHub organization that contains a repository and an organizational secret named DB_Credential. You need to build a workflow that will configure a server by using PowerShell and DB_Credential. How should you complete the code? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point. Answer:

Options

  • __typehotspot
  • variantdropdown

Explanation

This question tests knowledge of GitHub Actions workflow syntax for accessing organizational secrets and executing PowerShell scripts within a job step.

Approach. To use an organizational secret in a GitHub Actions workflow, you reference it using the 'secrets' context with the syntax '${{ secrets.DB_Credential }}' and assign it to an environment variable or pass it directly. The workflow must use 'runs-on' for the runner, a 'steps' block with a 'run' key, and specify 'shell: pwsh' (or 'shell: powershell') to execute PowerShell commands. The secret is accessed via '${{ secrets.DB_Credential }}' in the YAML, and within the PowerShell script it is referenced as an environment variable using '$env:DB_CREDENTIAL'. The job step should map the secret to an environment variable under the 'env' key of the step, e.g., 'env: DB_CREDENTIAL: ${{ secrets.DB_Credential }}', then use '$env:DB_CREDENTIAL' inside the PowerShell run block.

Concept tested. GitHub Actions workflow syntax for organizational secrets, PowerShell shell specification (shell: pwsh), secrets context reference (${{ secrets.SECRET_NAME }}), and environment variable mapping within job steps (env block).

Reference. https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions

Community Discussion

No community discussion yet for this question.

Full AZ-400 PracticeBrowse All AZ-400 Questions