Skip to content

Instantly share code, notes, and snippets.

@rick-roche
Created Jul 11, 2021
Embed
What would you like to do?
Azure - Lint, validate, create infra in Azure from Bicep templates
#!/bin/bash
RG=replace-with-your-rg
SUB=replace-with-your-sub
op=$1 # lint, validate, create
main_shared=$2
if [ "$main_shared" == 'main' ]; then path='./infra' && filename='main.bicep'; fi
if [ "$main_shared" == 'shared' ]; then path='./shared-infra' && filename='*.bicep'; fi
lint () {
az bicep build --file "$f" --stdout
}
validate () {
az deployment group validate --resource-group "$RG" --subscription "$SUB" -f "$1" -p env=dev
}
create () {
az deployment group create --resource-group "$RG" --subscription "$SUB" -f "$1" -p env=dev
}
for f in $(find "$path" -name "$filename") ; do
echo "$f"
$op "$f"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment