Agent skill
convert-bicep-to-avm
Converts Bicep resource definitions to Azure Verified Modules (AVM). Use when user asks to convert to AVM, replace resources with modules, use verified modules, or modernize bicep templates.
Install this agent skill to your Project
npx add-skill https://github.com/johnlokerse/azure-bicep-github-copilot/tree/main/.github/skills/convert-bicep-to-avm
SKILL.md
Converting Bicep to AVM Skill
Before Converting
Call Bicep:list_avm_metadata MCP tool to get available Azure Verified Modules and their versions.
Conversion Workflow
- Identify resources — List all
resourcedeclarations in the template - Find AVM matches — Call
Bicep:list_avm_metadata, match by resource type - Map properties — Translate resource properties to AVM parameters
- Generate module — Create
moduledeclaration with registry reference - Update references — Replace
resource.propertywithmodule.outputs.property - Validate — Lint the Bicep template and afterwards run
bicep buildto verify syntax - Fix errors — If build fails, review error, fix mapping, return to step 6
AVM Module Reference Format
module <symbolicName> 'br/public:avm/res/<provider>/<resource>:<version>' = {
params: {
name: <resourceName>
location: <location>
// AVM-specific parameters
}
}
Common Resource Type Mappings
| Resource Type | AVM Module Path |
|---|---|
Microsoft.KeyVault/vaults |
avm/res/key-vault/vault |
Microsoft.Storage/storageAccounts |
avm/res/storage/storage-account |
Microsoft.Web/sites |
avm/res/web/site |
Microsoft.Compute/virtualMachines |
avm/res/compute/virtual-machine |
Microsoft.Network/virtualNetworks |
avm/res/network/virtual-network |
Microsoft.ContainerRegistry/registries |
avm/res/container-registry/registry |
Microsoft.Sql/servers |
avm/res/sql/server |
⚠️ Always call Bicep:list_avm_metadata for current modules and versions. This table is for reference only and may be outdated.
Property Mapping Guidelines
Common Patterns
| Resource | AVM Parameter |
|---|---|
properties.sku.name |
skuName |
properties.sku.tier |
Often bundled in skuName |
tags |
tags (same) |
location |
location (same) |
name |
name (same) |
properties.accessPolicies |
accessPolicies (flattened) |
AVM Adds Common Features
AVM modules often include built-in support for:
- Diagnostic settings (
diagnosticSettings) - Role assignments (
roleAssignments) - Private endpoints (
privateEndpoints) - Locks (
lock) - Tags (
tags)
Handling No AVM Match
If no AVM module exists:
- Keep the resource definition
- Add comment:
// TODO: No AVM module available for <resourceType> - Check for pattern modules (
avm/ptn/*) as alternatives
Output Transformation
Before:
output keyVaultUri string = keyVault.properties.vaultUri
After:
output keyVaultUri string = keyVaultModule.outputs.uri
Note: AVM output names differ from properties — check module documentation.
Conversion Report Format
## AVM Conversion: [filename]
### Converted
| Resource | AVM Module | Version |
|----------|------------|---------|
| keyVault | avm/res/key-vault/vault | 0.11.0 |
### Not Converted
| Resource | Reason |
|----------|--------|
| customResource | No AVM module available |
### Manual Review Required
- [ ] Verify parameter mappings
- [ ] Update output references
- [ ] Test deployment
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
convert-loose-to-strong-type
Converts loosely typed Bicep parameters using object or array to strongly typed alternatives like string[], user-defined types, or resource-derived types. Use when user mentions type safety, weak typing, object parameters, array parameters, resourceInput, resourceOutput, or asks to improve parameter definitions.
format-bicep
Format Bicep code for readability and consistency.
run-bicep-in-console
Validates Bicep functions using bicep console with piped input. Use when user asks to test, validate, or run Bicep functions, or wants to verify function behavior with test cases.
obsidian-vault
Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
handoff
Compact the current conversation into a handoff document for another agent to pick up.
Didn't find tool you were looking for?