Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update storage acct creation to include storageInfrastructureEncyption property #2159

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions infra/core/storage/storage-account.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,19 @@ param publicNetworkAccess string = 'Enabled'
param sku object = { name: 'Standard_LRS' }
@allowed([ 'None', 'AzureServices' ])
param bypass string = 'AzureServices'
param storageInfrastructureEncryption string = 'Disabled'

var networkAcls = (publicNetworkAccess == 'Enabled') ? {
bypass: bypass
defaultAction: 'Allow'
} : { defaultAction: 'Deny' }

var encryption = (storageInfrastructureEncryption == 'Enabled') ? {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's going to be mapped to this object anyway, would it be better to make it a boolean?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just looked up the avm module, which we'll eventually move to, and it uses a boolean:
https://github.com/Azure/bicep-registry-modules/tree/main/avm/res/storage/storage-account#parameter-requireinfrastructureencryption

requireInfrastructureEncryption: true
} : {
requireInfrastructureEncryption: false
}

resource storage 'Microsoft.Storage/storageAccounts@2022-05-01' = {
name: name
location: location
Expand All @@ -49,6 +56,7 @@ resource storage 'Microsoft.Storage/storageAccounts@2022-05-01' = {
networkAcls: networkAcls
publicNetworkAccess: publicNetworkAccess
supportsHttpsTrafficOnly: supportsHttpsTrafficOnly
encryption: encryption
}

resource blobServices 'blobServices' = if (!empty(containers)) {
Expand Down
3 changes: 3 additions & 0 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ param storageResourceGroupName string = '' // Set in main.parameters.json
param storageResourceGroupLocation string = location
param storageContainerName string = 'content'
param storageSkuName string // Set in main.parameters.json
param storageInfrastructureEncryption string // Set in main.parameters.json

param userStorageAccountName string = ''
param userStorageContainerName string = 'user-content'
Expand Down Expand Up @@ -662,6 +663,7 @@ module storage 'core/storage/storage-account.bicep' = {
publicAccess: 'None'
}
]
storageInfrastructureEncryption: storageInfrastructureEncryption
}
}

Expand All @@ -688,6 +690,7 @@ module userStorage 'core/storage/storage-account.bicep' = if (useUserUpload) {
publicAccess: 'None'
}
]
storageInfrastructureEncryption: storageInfrastructureEncryption
}
}

Expand Down
3 changes: 3 additions & 0 deletions infra/main.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
"storageSkuName": {
"value": "${AZURE_STORAGE_SKU=Standard_LRS}"
},
"storageInfrastructureEncryption": {
"value": "${AZURE_STORAGE_INFRA_ENCRYPTION}"
},
"appServicePlanName": {
"value": "${AZURE_APP_SERVICE_PLAN}"
},
Expand Down
Loading