Reputation: 4668
When using plain JSON ARM templates we are able to create a Deploy to Azure
button by embedding a link following this format:
[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-storage-account-create%2Fazuredeploy.json)
This results in an easy to use action, that even works on Stackoverflow
Nice! But how can the same goal be achieved by using bicep templates?
Simply replacing the URL encoded part with a bicep file doesn't work. I am aware that bicep does a transpilation and produces a JSON-based ARM template.
However, as we are able to use the Azure CLI to directly deploy a bicep file, there might be another endpoint (like https://portal.azure.com/#create/Microsoft.Template/uri
) that does this for us.
Upvotes: 2
Views: 1023
Reputation: 11
Meanwhile, in a project of mine I created a GitHub workflow which build ARM template file based on Bicep template and 'automagically' commit to repository using Add&Commit action
This is a simple workflow template:
- name: Install Bicep build
run: |
curl -Lo bicepinstall
https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64
chmod +x ./bicepinstall
sudo mv ./bicepinstall /usr/local/bin/bicep
bicep --help
- name: Run Bicep build
run: |
bicep build deploy/main.bicep
ls -l deploy/*.json
- uses: EndBug/[email protected]
with:
author_name: github-actions
author_email: '41898282+github-actions[bot]@users.noreply.github.com'
message: Update Bicep-ARM template
add: deploy/main.json
Then in Readme file, you can insert standard Deploy button as described by bmoore-msft
Upvotes: 1
Reputation: 8737
Portal doesn't currently support this.
As a work around you can use the output of bicep build
and link the deploy button to the json file (that's what we'll be doing in the QuickStart repo until portal supports bicep natively).
Not ideal, but a point in time...
Upvotes: 2