Skip to content

Commit 4b3beeb

Browse files
committed
add Azure Storage Account
1 parent 9f7ccd0 commit 4b3beeb

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

infra/main.bicep

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ param openAiDeployments array = []
1818
@description('Specifies the name of the Azure Cognitive Services resource.')
1919
param cognitiveServicesName string = '${prefix}cognitiveServices'
2020

21+
@description('Specifies the name of the Azure Storage Account resource.')
22+
param storageAccountName string = '${prefix}sa'
23+
2124
module openAi './modules/openAi.bicep' = {
2225
name: 'openAi'
2326
params: {
@@ -44,3 +47,16 @@ module cognitiveServices './modules/cognitiveServices.bicep' = {
4447
tags: tags
4548
}
4649
}
50+
51+
module storageAccount './modules/storageAccount.bicep' = {
52+
name: 'storageAccount'
53+
params: {
54+
name: storageAccountName
55+
containerNames: [
56+
'dev'
57+
'prod'
58+
]
59+
location: location
60+
tags: tags
61+
}
62+
}

infra/modules/storageAccount.bicep

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Parameters
2+
@description('Specifies the name of the storage account.')
3+
param name string
4+
5+
@description('Specifies an array of containers to create.')
6+
param containerNames array = []
7+
8+
@description('Specifies the location.')
9+
param location string = resourceGroup().location
10+
11+
@description('Specifies the resource tags.')
12+
param tags object = {}
13+
14+
// Resources
15+
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-04-01' = {
16+
name: name
17+
location: location
18+
tags: tags
19+
sku: {
20+
name: 'Standard_LRS'
21+
}
22+
kind: 'StorageV2'
23+
24+
// Containers live inside of a blob service
25+
resource blobService 'blobServices' = {
26+
name: 'default'
27+
properties: {
28+
deleteRetentionPolicy: {
29+
enabled: false
30+
allowPermanentDelete: false
31+
}
32+
}
33+
// Creating containers with provided names
34+
resource containers 'containers' = [for containerName in containerNames: {
35+
name: containerName
36+
properties: {
37+
publicAccess: 'None'
38+
defaultEncryptionScope:'$account-encryption-key'
39+
denyEncryptionScopeOverride: false
40+
}
41+
}]
42+
}
43+
}
44+
45+
// Outputs
46+
output id string = storageAccount.id
47+
output name string = storageAccount.name

0 commit comments

Comments
 (0)