Fabrikam deploys its agent infrastructure with one Bicep file, infrastructure/main.bicep, for all environments. The exhibit shows an excerpt of the file.
You are writing the production deployment job. Requirements:
- Designated reviewers must approve before the production deployment steps run. A repository administrator has already added these reviewers in the GitHub repository settings, under the environment named
production. - The job must deploy the template into the existing resource group
fabrikam-agents-production. - The template must apply its production values for model, compute, and scaling.
// Excerpt of infrastructure/main.bicep
@description('Environment name: dev, staging, or production')
@allowed(['dev', 'staging', 'production'])
param environment string
@description('Azure region for deployment')
param location string = resourceGroup().location
@description('Agent name')
param agentName string
Complete the job so that it meets all the requirements.
jobs:
deploy-production:
runs-on: ubuntu-latest
: production
steps:
- uses: actions/checkout@v4
- name: Azure Login
uses: azure/login@v1
with:
creds: $
- name: Deploy agent infrastructure
run: |
az deployment create \
--resource-group fabrikam-agents-production \
--template-file infrastructure/main.bicep \
--parameters environment= agentName=orchestrator- Blank 1: environment (correct answer)
Declaring
environment: productionbinds the job to the protected GitHub environment. GitHub then pauses at that declaration and notifies the required reviewers.needsnames prerequisite jobs, not an approval gate.concurrencygroups runs to limit parallel execution.permissionssets GITHUB_TOKEN scopes and does not accept an environment name. None of these three makes the job wait for reviewer approval. - Blank 2: group (correct answer)
The requirement is to deploy into an existing resource group. The command passes
--resource-group, and the template readsresourceGroup().location, so it is a resource-group-scope deployment:az deployment group create.sub,mg, andtenantdeploy at subscription, management group, and tenant scope. Those commands do not target a resource group with--resource-group. - Blank 3: production (correct answer)
The template's allowed values are dev, staging, and production, and the job must apply production settings, so the value is
production.devandstagingare valid values but would deploy the smaller non-production configuration.prodis not in the @allowed list, so the deployment would be rejected.
The approval gate comes from a GitHub environment protection rule. The reviewers are already configured on the production environment, so the job only needs to declare environment: production. GitHub then pauses the job until a reviewer approves. The infrastructure is deployed as code by running one Bicep template at resource-group scope with az deployment group create. The environment parameter, restricted to dev, staging, or production, selects the production-specific model, compute, and scaling values.