bicep
Bicep Expert Assistant
Expert guidance for Azure Bicep infrastructure-as-code development, including best practices, resource type discovery, schema retrieval, and Azure Verified Modules.
Triggers
Use this skill when you see:
- bicep, azure bicep, arm template
- infrastructure as code, iac, azure deployment
- avm, azure verified modules
- resource type, api version, bicep module
Instructions
Resource Type Discovery
# List resource types for a provider
az provider show --namespace Microsoft.Storage --query "resourceTypes[].{Type:resourceType,ApiVersions:apiVersions[0]}" -o table
# Common providers
az provider show --namespace Microsoft.Compute
az provider show --namespace Microsoft.Network
az provider show --namespace Microsoft.KeyVault
Parameters Best Practices
// Use descriptive names with descriptions
@description('The name of the storage account. Must be globally unique.')
param storageAccountName string
// Set safe defaults with constraints
@description('The SKU for the storage account')
@allowed(['Standard_LRS', 'Standard_GRS', 'Standard_ZRS', 'Premium_LRS'])
param storageAccountSku string = 'Standard_LRS'
// Apply length constraints
@minLength(3)
@maxLength(24)
param storageAccountName string
// Secure sensitive parameters
@secure()
param adminPassword string
Variables
// Use for computed values
var storageAccountName = '${prefix}${uniqueString(resourceGroup().id)}'
// Use for repeated values
var commonTags = {
environment: environment
project: projectName
deployedBy: 'Bicep'
}
// Typed variables (Bicep 0.26+)
var instanceCount int = environment == 'prod' ? 5 : 2
Resources
// Use symbolic names without 'name' suffix
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
name: storageAccountName
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
properties: {
accessTier: 'Hot'
supportsHttpsTrafficOnly: true
minimumTlsVersion: 'TLS1_2'
}
}
// Use existing keyword for references
resource existingVnet 'Microsoft.Network/virtualNetworks@2023-09-01' existing = {
name: vnetName
}
Child Resources
// Nested declaration (preferred)
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
name: storageAccountName
// ...
resource blobService 'blobServices' = {
name: 'default'
}
}
// Or use parent property
resource blobService 'Microsoft.Storage/storageAccounts/blobServices@2023-05-01' = {
parent: storageAccount
name: 'default'
}
Modules
// Local module
module storageModule 'modules/storage.bicep' = {
name: 'storageDeployment'
params: {
storageAccountName: storageAccountName
location: location
}
}
// Azure Verified Module from Registry
module storage 'br/public:avm/res/storage/storage-account:0.9.0' = {
name: 'storageDeployment'
params: {
name: storageAccountName
location: location
}
}
Outputs
// Expose essential values
output storageAccountId string = storageAccount.id
output primaryEndpoints object = storageAccount.properties.primaryEndpoints
// NEVER output secrets
// WRONG - Never do this:
// output connectionString string = storageAccount.listKeys().keys[0].value
Common Resource Examples
Storage Account
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
name: storageAccountName
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
properties: {
accessTier: 'Hot'
supportsHttpsTrafficOnly: true
minimumTlsVersion: 'TLS1_2'
}
}
Virtual Network
resource vnet 'Microsoft.Network/virtualNetworks@2023-09-01' = {
name: vnetName
location: location
properties: {
addressSpace: {
addressPrefixes: ['10.0.0.0/16']
}
subnets: [
{
name: 'default'
properties: {
addressPrefix: '10.0.1.0/24'
}
}
]
}
}
Key Vault
resource keyVault 'Microsoft.KeyVault/vaults@2023-07-01' = {
name: keyVaultName
location: location
properties: {
tenantId: subscription().tenantId
sku: {
family: 'A'
name: 'standard'
}
enableRbacAuthorization: true
enableSoftDelete: true
softDeleteRetentionInDays: 90
}
}
Azure Verified Modules (AVM)
Using AVM Modules
// Reference from Bicep Public Registry
module storage 'br/public:avm/res/storage/storage-account:0.9.0' = {
name: 'storageDeployment'
params: {
name: 'mystorageaccount'
location: location
}
}
Module Types
- Resource Modules (
avm/res/): Single Azure resource with all configurations - Pattern Modules (
avm/ptn/): Multi-resource patterns for common scenarios - Utility Modules (
avm/utl/): Helper types and functions
Finding AVM Modules
- Browse: https://azure.github.io/Azure-Verified-Modules/indexes/bicep/
- GitHub: https://github.com/Azure/bicep-registry-modules
File Organization
project/
├── main.bicep # Entry point
├── main.bicepparam # Parameters file
├── modules/
│ ├── networking.bicep
│ ├── storage.bicep
│ └── compute.bicep
└── tests/
└── main.tests.bicep
Order of Elements
- Target scope (if not resourceGroup)
- Parameters
- Variables
- Resources
- Modules
- Outputs
Best Practices
- Naming: Use camelCase for parameters, variables, and symbolic names
- Uniqueness: Use
uniqueString()for globally unique names - API Versions: Use latest stable API versions
- Security: Use managed identities, enable HTTPS/TLS, use private endpoints
- Modules: Version your modules, use AVM when available
Common Workflows
New Bicep Template
- Define parameters with descriptions and constraints
- Create variables for computed values
- Define resources with proper dependencies
- Use modules for reusability
- Output essential values (never secrets)
- Test with
bicep buildand what-if deployment
More from housegarofalo/claude-code-base
postgresql
Design, optimize, and manage PostgreSQL databases. Covers indexing, pgvector for AI embeddings, JSON operations, full-text search, and query optimization. Use when working with PostgreSQL, database design, or building data-intensive applications.
6home-assistant
Ultimate Home Assistant skill - complete administration, wireless protocols (Zigbee/ZHA/Z2M, Z-Wave JS, Thread, Matter), ESPHome device building, advanced troubleshooting, performance optimization, security hardening, custom integration development, and professional dashboard design. Covers configuration, REST API, automation debugging, database optimization, SSL/TLS, Jinja2 templating, and HACS custom cards. Use for any HA task.
6testing
Comprehensive testing skill covering unit, integration, and E2E testing with pytest, Jest, Cypress, and Playwright. Use for writing tests, improving coverage, debugging test failures, and setting up testing infrastructure.
5react-typescript
Build modern React applications with TypeScript. Covers React 18+ patterns, hooks, component architecture, state management (Zustand, Redux Toolkit), server components, and best practices. Use for React development, TypeScript integration, component design, and frontend architecture.
5power-automate
Expert guidance for Power Automate development including cloud flows, desktop flows, Dataverse connector, expression functions, custom connectors, error handling, and child flow patterns. Use when building automated workflows, writing flow expressions, creating custom connectors from OpenAPI, or implementing error handling patterns.
5mobile-pwa
Build Progressive Web Apps with offline support, push notifications, and native-like experiences. Covers service workers, Web App Manifest, caching strategies, IndexedDB, background sync, and installability. Use for mobile-first web apps, offline-capable applications, and app-like experiences.
5