Bicep with GitHub Actions
In this quick start, you use the GitHub Actions for Azure Resource Manager deployment to automate deploying a Bicep file to Azure.
Create a resource group for the deployment.
Create or use an existing service princprincipal
Create secrets for your Azure credentials, resource group, and subscriptions.
In GitHub, navigate to your repository.
Select Security > Secrets and variables > Actions > New repository secret.
Paste the entire JSON output from the Azure CLI command into the secret's value field. Name the secret
AZURE_CREDENTIALS
.Create another secret named
AZURE_RG
. Add the name of your resource group to the secret's value field (exampleRG
).Create another secret named
AZURE_SUBSCRIPTION
. Add your subscription ID to the secret's value field (example:90fd3f9d-4c61-432d-99ba-1273f236afa2
).
Create workflow
A workflow defines the steps to execute when triggered. It's a YAML (.yml) file in the .github/workflows/ path of your repository. The workflow file extension can be either .yml or .yaml.
To create a workflow, take the following steps:
From your GitHub repository, select Actions from the top menu.
Select New workflow.
Select set up a workflow yourself.
Rename the workflow file if you prefer a different name other than main.yml. For example: deployBicepFile.yml.
Replace the content of the yml file with the following code:
Select Start commit.
Select Commit directly to the main branch.
Select Commit new file (or Commit changes).
Check workflow status
Select the Actions tab. You'll see a Create
deployStorageAccount.yml
workflow listed. It takes 1-2 minutes to run the workflow.Select the workflow to open it.
Select Run ARM deploy from the menu to verify the deployment.
Last updated