Skip to content

Commit 268c449

Browse files
shawntmeyerShawn Meyer
andauthored
[Modules] StorageAccounts - new feature - sasPolicy (#3028)
* initial commit * removed expirationAction Parameter because not needed * updated readme --------- Co-authored-by: Shawn Meyer <shawn.meyer@microsoft.com>
1 parent f0a9372 commit 268c449

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

modules/Microsoft.Storage/storageAccounts/.test/common/deploy.test.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ module testDeployment '../../deploy.bicep' = {
213213
}
214214
]
215215
}
216+
sasExpirationPeriod: '180.00:00:00'
216217
systemAssignedIdentity: true
217218
userAssignedIdentities: {
218219
'${nestedDependencies.outputs.managedIdentityResourceId}': {}

modules/Microsoft.Storage/storageAccounts/deploy.bicep

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ param cMKKeyVersion string = ''
201201
@description('Optional. The name of the diagnostic setting, if deployed. If left empty, it defaults to "<resourceName>-diagnosticSettings".')
202202
param diagnosticSettingsName string = ''
203203

204+
@description('Optional. The SAS expiration period. DD.HH:MM:SS.')
205+
param sasExpirationPeriod string = ''
206+
204207
var diagnosticsMetrics = [for metric in diagnosticMetricsToEnable: {
205208
category: metric
206209
timeGrain: null
@@ -286,6 +289,10 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
286289
} : null
287290
}
288291
accessTier: storageAccountKind != 'Storage' ? storageAccountAccessTier : null
292+
sasPolicy: !empty(sasExpirationPeriod) ? {
293+
expirationAction: 'Log'
294+
sasExpirationPeriod: sasExpirationPeriod
295+
} : null
289296
supportsHttpsTrafficOnly: supportsHttpsTrafficOnly
290297
isHnsEnabled: enableHierarchicalNamespace ? enableHierarchicalNamespace : null
291298
isSftpEnabled: enableSftp

modules/Microsoft.Storage/storageAccounts/readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ This module is used to deploy a storage account, with the ability to deploy 1 or
9090
| `queueServices` | _[queueServices](queueServices/readme.md)_ object | `{object}` | | Queue service and queues to create. |
9191
| `requireInfrastructureEncryption` | bool | `True` | | A Boolean indicating whether or not the service applies a secondary layer of encryption with platform managed keys for data at rest. For security reasons, it is recommended to set it to true. |
9292
| `roleAssignments` | array | `[]` | | Array of role assignment objects that contain the 'roleDefinitionIdOrName' and 'principalId' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or its fully qualified ID in the following format: '/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11'. |
93+
| `sasExpirationPeriod` | string | `''` | | The SAS expiration period. DD.HH:MM:SS. |
9394
| `storageAccountKind` | string | `'StorageV2'` | `[BlobStorage, BlockBlobStorage, FileStorage, Storage, StorageV2]` | Type of Storage Account to create. |
9495
| `storageAccountSku` | string | `'Standard_GRS'` | `[Premium_LRS, Premium_ZRS, Standard_GRS, Standard_GZRS, Standard_LRS, Standard_RAGRS, Standard_RAGZRS, Standard_ZRS]` | Storage Account Sku Name. |
9596
| `supportsHttpsTrafficOnly` | bool | `True` | | Allows HTTPS traffic only to storage service if sets to true. |
@@ -585,6 +586,7 @@ module storageAccounts './Microsoft.Storage/storageAccounts/deploy.bicep' = {
585586
roleDefinitionIdOrName: 'Reader'
586587
}
587588
]
589+
sasExpirationPeriod: '180.00:00:00'
588590
storageAccountSku: 'Standard_LRS'
589591
systemAssignedIdentity: true
590592
tableServices: {
@@ -820,6 +822,9 @@ module storageAccounts './Microsoft.Storage/storageAccounts/deploy.bicep' = {
820822
}
821823
]
822824
},
825+
"sasExpirationPeriod": {
826+
"value": "180.00:00:00"
827+
},
823828
"storageAccountSku": {
824829
"value": "Standard_LRS"
825830
},

0 commit comments

Comments
 (0)