With the new release of Bicep (v0.4.1124) it is now possible to export existing Azure resources to Bicep code. This means you do not have to export your resources to ARM and then do a decompile.
Exporting your existing resources is very easy and can be done within Visual Studio Code.
Get Resource ID
To be able to export the resource to Bicep you need to have the resource ID of the resource. You can find this resource very easily by opening the resource within Azure and opening the “properties” blade. One of the properties in this blade is the Resource ID
To export the template follow these steps:
- Open Visual Studio Code
- Open an existing “bicep” file or create a new one.
- Press ctrl+shift+p or open the command pallet.
- Search for “Bicep” and select the option “Insert resource”.
- This will ask for the resource ID. Paste the resource ID and press enter.
- The resource is now imported within your Bicep file.