Advanced Features
Deployment scripts in Bicep allow you to execute custom scripts during deployment to fill gaps in native resource provider capabilities and handle complex automation tasks.
Why Use Inline Scripts?
Real-Life DevOps & SRE Examples
1. Run a Bash Script to Tag Resources
resource tagScript 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
name: 'tag-script'
location: resourceGroup().location
kind: 'AzureCLI'
properties: {
azCliVersion: '2.53.0'
scriptContent: '''
az resource tag --tags environment=devops owner=sre \
--ids ${resourceId('Microsoft.Storage/storageAccounts', 'mystorageaccount')}
'''
timeout: 'PT10M'
cleanupPreference: 'OnSuccess'
forceUpdateTag: uniqueString(newGuid())
}
}2. Run a PowerShell Script to Set Diagnostic Settings
Best Practices (2025)
Common Pitfalls
Azure & Bicep Jokes
References
PreviousExamples - Sample implementations for common scenariosNextCI/CD Integration - Automating Bicep deployments
Last updated