Last active
December 5, 2022 12:23
-
-
Save manoj-choudhari-git/a22207a421687e48f91fdf4421601a31 to your computer and use it in GitHub Desktop.
Azure Bicep - Conditional Logic to deploy the storage account
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
@description('Environment name') | |
@allowed([ | |
'featurebranch' | |
'dev' | |
'test' | |
'uat' | |
'production' | |
]) | |
param environmentName string = 'dev' | |
var createStorageAccount = environmentName != 'featurebranch' | |
@description('Storage Account type') | |
@allowed([ | |
'Premium_LRS' | |
'Premium_ZRS' | |
'Standard_GRS' | |
'Standard_GZRS' | |
'Standard_LRS' | |
'Standard_RAGRS' | |
'Standard_RAGZRS' | |
'Standard_ZRS' | |
]) | |
param storageAccountType string = 'Standard_LRS' | |
@description('Location for the storage account.') | |
param location string = resourceGroup().location | |
@description('The name of the Storage Account') | |
param storageAccountName string = 'storageaccount1' | |
// if createStorageAccount is true, then only the storage account is created. | |
resource sa 'Microsoft.Storage/storageAccounts@2021-06-01' = if (createStorageAccount) { | |
name: storageAccountName | |
location: location | |
sku: { | |
name: storageAccountType | |
} | |
kind: 'StorageV2' | |
properties: {} | |
} | |
output storageAccountName string = storageAccountName | |
output storageAccountId string = sa.id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment