Deploy to your Staging environment
Azure Bicep lets you define Azure resources together into a logical deployment as Infrastructure as Code. A deployment could use resources that you defined directly or pull together Bicep modules that your organization has defined as standard patterns. Either way, a key goal after developing your Bicep deployment is to deploy your code to Azure.
Configure Workflow environment variables to pin to the same version of Azure CLI and Bicep across your Workflow:
env:
AZCLI_VERSION: 2.52.0
BICEP_VERSION: 0.21.1
Here is an example Workflow job for deploying to your “Development” environment:
deploy-dev:
name: Deploy (Development)
runs-on: ubuntu-latest
concurrency: ${{ github.ref }}
environment:
name: Development
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: AzCLI login
uses: azure/login@v1
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
- name: Deploy
uses: azure/CLI@v1
with:
azcliversion: ${{ env.AZCLI_VERSION }}
inlineScript: |
az bicep install --version v${{ env.BICEP_VERSION }}
az deployment group create \
--resource-group ${{ vars.AZURE_RESOURCE_GROUP }} \
--name 'main' \
--template-file ./src/main.bicep \
--parameters ./src/dev.bicepparam \
--query "properties.outputs"