-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Brief document on
decompile
command (#998)
* Create decompiling.md * Update decompiling.md * Update README.md
- Loading branch information
1 parent
7e07f45
commit 5c94339
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Decompiling an ARM Template | ||
|
||
> Requires Bicep CLI v0.2.59 or later | ||
The Bicep CLI provides the ability to decompile any existing ARM Template to a `.bicep` file, using the `decompile` command: | ||
```sh | ||
bicep decompile "path/to/file.json" | ||
``` | ||
|
||
You can use this command to get to a starting point for Bicep authoring. Note that because there is no guaranteed conversion from JSON to Bicep, decompilation may fail, or you may be left with errors/warnings in the generated Bicep file to fix up. See [Limitations](#limiations) for some details of what is not currently possible. | ||
|
||
## Exporting a resource group | ||
You can pass an exported template directly to the `bicep decompile` command to effectively export a resource group to a `.bicep` file. | ||
|
||
### Azure CLI | ||
The following will create a file named 'main.bicep' in the current directory: | ||
```sh | ||
az group export --name "your_resource_group_name" > main.json | ||
bicep decompile main.json | ||
``` | ||
### Azure PowerShell | ||
The following will create a file named 'main.bicep' in the current directory: | ||
```powershell | ||
Export-AzResourceGroup -ResourceGroupName "your_resource_group_name" -Path ./main.json | ||
bicep decompile main.json | ||
``` | ||
|
||
### Azure Portal | ||
See [Export Template](https://aka.ms/armexport) for guidance. Use `bicep decompile <filename>` on the downloaded file. | ||
|
||
|
||
## Current Limitations | ||
The following are temporary limiations on the `bicep decompile` command: | ||
* Templates using copy loops or conditionals cannot be decompiled | ||
* Nested templates cannot be decompiled | ||
* Cross-scope linked templates cannot be decompiled |