Coder Perfect

Is there a way to build a bicep file for an Azure resource that already exists?

Problem

I’m now working on bicep files for our current Azure resources. Is it possible to make a bicep file from an existing Azure resource, such as a storage account or an app service?

Asked by SamIAm

Solution #1

You should be able to complete the task. However, for the resource, you’ll need to use the ARM template. Once you have it, you may decompile the template with Bicep CLI.

From this link:

az bicep decompile --file main.json

Another option is to use Bicep Playground, which can also convert an ARM template JSON to a Bicep file.

Answered by Gaurav Mantri

Post is based on https://stackoverflow.com/questions/69354469/is-there-a-way-to-generate-a-bicep-file-for-an-existing-azure-resource