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

[Fixes] Address BlobServices linter warning #4262

Merged
merged 2 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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: 2 additions & 6 deletions modules/storage/storage-account/blob-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ This module deploys a Storage Account Blob Service.
| [`enableDefaultTelemetry`](#parameter-enabledefaulttelemetry) | bool | Enable telemetry via a Globally Unique Identifier (GUID). |
| [`isVersioningEnabled`](#parameter-isversioningenabled) | bool | Use versioning to automatically maintain previous versions of your blobs. |
| [`lastAccessTimeTrackingPolicyEnabled`](#parameter-lastaccesstimetrackingpolicyenabled) | bool | The blob service property to configure last access time based tracking policy. When set to true last access time based tracking is enabled. |
| [`restorePolicyDays`](#parameter-restorepolicydays) | int | how long this blob can be restored. It should be less than DeleteRetentionPolicy days. |
| [`restorePolicyDays`](#parameter-restorepolicydays) | int | How long this blob can be restored. It should be less than DeleteRetentionPolicy days. |
| [`restorePolicyEnabled`](#parameter-restorepolicyenabled) | bool | The blob service properties for blob restore policy. If point-in-time restore is enabled, then versioning, change feed, and blob soft delete must also be enabled. |

### Parameter: `automaticSnapshotPolicyEnabled`
Expand All @@ -69,7 +69,6 @@ The blob service properties for change feed events. Indicates whether change fee
Indicates whether change feed event logging is enabled for the Blob service. Indicates the duration of changeFeed retention in days. A "0" value indicates an infinite retention of the change feed.
- Required: No
- Type: int
- Default: `7`

### Parameter: `containerDeleteRetentionPolicyAllowPermanentDelete`

Expand All @@ -83,7 +82,6 @@ This property when set to true allows deletion of the soft deleted blob versions
Indicates the number of days that the deleted item should be retained.
- Required: No
- Type: int
- Default: `7`

### Parameter: `containerDeleteRetentionPolicyEnabled`

Expand Down Expand Up @@ -125,7 +123,6 @@ This property when set to true allows deletion of the soft deleted blob versions
Indicates the number of days that the deleted blob should be retained.
- Required: No
- Type: int
- Default: `7`

### Parameter: `deleteRetentionPolicyEnabled`

Expand Down Expand Up @@ -272,10 +269,9 @@ The blob service property to configure last access time based tracking policy. W

### Parameter: `restorePolicyDays`

how long this blob can be restored. It should be less than DeleteRetentionPolicy days.
How long this blob can be restored. It should be less than DeleteRetentionPolicy days.
- Required: No
- Type: int
- Default: `6`

### Parameter: `restorePolicyEnabled`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "5294108325383402237"
"version": "0.23.1.45101",
"templateHash": "11642031800707172818"
},
"name": "Storage Account Blob Container Immutability Policies",
"description": "This module deploys a Storage Account Blob Container Immutability Policy.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "15140230336138320985"
"version": "0.23.1.45101",
"templateHash": "11413707823135400961"
},
"name": "Storage Account Blob Containers",
"description": "This module deploys a Storage Account Blob Container.",
Expand Down Expand Up @@ -302,8 +302,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "5294108325383402237"
"version": "0.23.1.45101",
"templateHash": "11642031800707172818"
},
"name": "Storage Account Blob Container Immutability Policies",
"description": "This module deploys a Storage Account Blob Container Immutability Policy.",
Expand Down
30 changes: 15 additions & 15 deletions modules/storage/storage-account/blob-service/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ param changeFeedEnabled bool = true
@minValue(0)
@maxValue(146000)
@description('Optional. Indicates whether change feed event logging is enabled for the Blob service. Indicates the duration of changeFeed retention in days. A "0" value indicates an infinite retention of the change feed.')
param changeFeedRetentionInDays int = 7
param changeFeedRetentionInDays int?

@description('Optional. The blob service properties for container soft delete. Indicates whether DeleteRetentionPolicy is enabled.')
param containerDeleteRetentionPolicyEnabled bool = true

@minValue(1)
@maxValue(365)
@description('Optional. Indicates the number of days that the deleted item should be retained.')
param containerDeleteRetentionPolicyDays int = 7
param containerDeleteRetentionPolicyDays int?

@description('Optional. This property when set to true allows deletion of the soft deleted blob versions and snapshots. This property cannot be used with blob restore policy. This property only applies to blob service and does not apply to containers or file share.')
param containerDeleteRetentionPolicyAllowPermanentDelete bool = false
Expand All @@ -40,7 +40,7 @@ param deleteRetentionPolicyEnabled bool = true
@minValue(1)
@maxValue(365)
@description('Optional. Indicates the number of days that the deleted blob should be retained.')
param deleteRetentionPolicyDays int = 7
param deleteRetentionPolicyDays int?

@description('Optional. This property when set to true allows deletion of the soft deleted blob versions and snapshots. This property cannot be used with blob restore policy. This property only applies to blob service and does not apply to containers or file share.')
param deleteRetentionPolicyAllowPermanentDelete bool = false
Expand All @@ -55,8 +55,8 @@ param lastAccessTimeTrackingPolicyEnabled bool = false
param restorePolicyEnabled bool = true

@minValue(1)
@description('Optional. how long this blob can be restored. It should be less than DeleteRetentionPolicy days.')
param restorePolicyDays int = 6
@description('Optional. How long this blob can be restored. It should be less than DeleteRetentionPolicy days.')
param restorePolicyDays int?

@description('Optional. Blob containers to create.')
param containers array = []
Expand Down Expand Up @@ -93,13 +93,13 @@ resource blobServices 'Microsoft.Storage/storageAccounts/blobServices@2022-09-01
parent: storageAccount
properties: {
automaticSnapshotPolicyEnabled: automaticSnapshotPolicyEnabled
changeFeed: {
enabled: changeFeedEnabled
retentionInDays: changeFeedEnabled == true ? (changeFeedRetentionInDays != 0 ? changeFeedRetentionInDays : null) : null
}
changeFeed: changeFeedEnabled ? {
enabled: true
retentionInDays: changeFeedRetentionInDays
} : null
containerDeleteRetentionPolicy: {
enabled: containerDeleteRetentionPolicyEnabled
days: containerDeleteRetentionPolicyEnabled == true ? containerDeleteRetentionPolicyDays : null
days: containerDeleteRetentionPolicyDays
allowPermanentDelete: containerDeleteRetentionPolicyEnabled == true ? containerDeleteRetentionPolicyAllowPermanentDelete : null
}
cors: {
Expand All @@ -108,7 +108,7 @@ resource blobServices 'Microsoft.Storage/storageAccounts/blobServices@2022-09-01
defaultServiceVersion: !empty(defaultServiceVersion) ? defaultServiceVersion : null
deleteRetentionPolicy: {
enabled: deleteRetentionPolicyEnabled
days: deleteRetentionPolicyEnabled == true ? deleteRetentionPolicyDays : null
days: deleteRetentionPolicyDays
allowPermanentDelete: deleteRetentionPolicyEnabled && deleteRetentionPolicyAllowPermanentDelete ? true : null
}
isVersioningEnabled: isVersioningEnabled
Expand All @@ -117,10 +117,10 @@ resource blobServices 'Microsoft.Storage/storageAccounts/blobServices@2022-09-01
name: lastAccessTimeTrackingPolicyEnabled == true ? 'AccessTimeTracking' : null
trackingGranularityInDays: lastAccessTimeTrackingPolicyEnabled == true ? 1 : null
}
restorePolicy: {
enabled: restorePolicyEnabled
days: restorePolicyEnabled == true ? restorePolicyDays : null
}
restorePolicy: restorePolicyEnabled ? {
enabled: true
days: restorePolicyDays
} : null
}
}

Expand Down
36 changes: 15 additions & 21 deletions modules/storage/storage-account/blob-service/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "3026533312164325767"
"version": "0.23.1.45101",
"templateHash": "18255279964987657305"
},
"name": "Storage Account blob Services",
"description": "This module deploys a Storage Account Blob Service.",
Expand Down Expand Up @@ -144,7 +144,7 @@
},
"changeFeedRetentionInDays": {
"type": "int",
"defaultValue": 7,
"nullable": true,
"minValue": 0,
"maxValue": 146000,
"metadata": {
Expand All @@ -160,7 +160,7 @@
},
"containerDeleteRetentionPolicyDays": {
"type": "int",
"defaultValue": 7,
"nullable": true,
"minValue": 1,
"maxValue": 365,
"metadata": {
Expand Down Expand Up @@ -197,7 +197,7 @@
},
"deleteRetentionPolicyDays": {
"type": "int",
"defaultValue": 7,
"nullable": true,
"minValue": 1,
"maxValue": 365,
"metadata": {
Expand Down Expand Up @@ -234,10 +234,10 @@
},
"restorePolicyDays": {
"type": "int",
"defaultValue": 6,
"nullable": true,
"minValue": 1,
"metadata": {
"description": "Optional. how long this blob can be restored. It should be less than DeleteRetentionPolicy days."
"description": "Optional. How long this blob can be restored. It should be less than DeleteRetentionPolicy days."
}
},
"containers": {
Expand Down Expand Up @@ -292,13 +292,10 @@
"name": "[format('{0}/{1}', parameters('storageAccountName'), variables('name'))]",
"properties": {
"automaticSnapshotPolicyEnabled": "[parameters('automaticSnapshotPolicyEnabled')]",
"changeFeed": {
"enabled": "[parameters('changeFeedEnabled')]",
"retentionInDays": "[if(equals(parameters('changeFeedEnabled'), true()), if(not(equals(parameters('changeFeedRetentionInDays'), 0)), parameters('changeFeedRetentionInDays'), null()), null())]"
},
"changeFeed": "[if(parameters('changeFeedEnabled'), createObject('enabled', true(), 'retentionInDays', parameters('changeFeedRetentionInDays')), null())]",
"containerDeleteRetentionPolicy": {
"enabled": "[parameters('containerDeleteRetentionPolicyEnabled')]",
"days": "[if(equals(parameters('containerDeleteRetentionPolicyEnabled'), true()), parameters('containerDeleteRetentionPolicyDays'), null())]",
"days": "[parameters('containerDeleteRetentionPolicyDays')]",
"allowPermanentDelete": "[if(equals(parameters('containerDeleteRetentionPolicyEnabled'), true()), parameters('containerDeleteRetentionPolicyAllowPermanentDelete'), null())]"
},
"cors": {
Expand All @@ -307,7 +304,7 @@
"defaultServiceVersion": "[if(not(empty(parameters('defaultServiceVersion'))), parameters('defaultServiceVersion'), null())]",
"deleteRetentionPolicy": {
"enabled": "[parameters('deleteRetentionPolicyEnabled')]",
"days": "[if(equals(parameters('deleteRetentionPolicyEnabled'), true()), parameters('deleteRetentionPolicyDays'), null())]",
"days": "[parameters('deleteRetentionPolicyDays')]",
"allowPermanentDelete": "[if(and(parameters('deleteRetentionPolicyEnabled'), parameters('deleteRetentionPolicyAllowPermanentDelete')), true(), null())]"
},
"isVersioningEnabled": "[parameters('isVersioningEnabled')]",
Expand All @@ -316,10 +313,7 @@
"name": "[if(equals(parameters('lastAccessTimeTrackingPolicyEnabled'), true()), 'AccessTimeTracking', null())]",
"trackingGranularityInDays": "[if(equals(parameters('lastAccessTimeTrackingPolicyEnabled'), true()), 1, null())]"
},
"restorePolicy": {
"enabled": "[parameters('restorePolicyEnabled')]",
"days": "[if(equals(parameters('restorePolicyEnabled'), true()), parameters('restorePolicyDays'), null())]"
}
"restorePolicy": "[if(parameters('restorePolicyEnabled'), createObject('enabled', true(), 'days', parameters('restorePolicyDays')), null())]"
},
"dependsOn": [
"storageAccount"
Expand Down Expand Up @@ -388,8 +382,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "15140230336138320985"
"version": "0.23.1.45101",
"templateHash": "11413707823135400961"
},
"name": "Storage Account Blob Containers",
"description": "This module deploys a Storage Account Blob Container.",
Expand Down Expand Up @@ -685,8 +679,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "5294108325383402237"
"version": "0.23.1.45101",
"templateHash": "11642031800707172818"
},
"name": "Storage Account Blob Container Immutability Policies",
"description": "This module deploys a Storage Account Blob Container Immutability Policy.",
Expand Down
8 changes: 4 additions & 4 deletions modules/storage/storage-account/file-service/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "5811848536316127521"
"version": "0.23.1.45101",
"templateHash": "6280006322501716234"
},
"name": "Storage Account File Share Services",
"description": "This module deploys a Storage Account File Share Service.",
Expand Down Expand Up @@ -271,8 +271,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "6928373168012003070"
"version": "0.23.1.45101",
"templateHash": "15538733704323873805"
},
"name": "Storage Account File Shares",
"description": "This module deploys a Storage Account File Share.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "6928373168012003070"
"version": "0.23.1.45101",
"templateHash": "15538733704323873805"
},
"name": "Storage Account File Shares",
"description": "This module deploys a Storage Account File Share.",
Expand Down
4 changes: 2 additions & 2 deletions modules/storage/storage-account/local-user/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.22.6.54827",
"templateHash": "17857562856314258952"
"version": "0.23.1.45101",
"templateHash": "11792662730124549359"
},
"name": "Storage Account Local Users",
"description": "This module deploys a Storage Account Local User, which is used for SFTP authentication.",
Expand Down
8 changes: 4 additions & 4 deletions modules/storage/storage-account/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -402,19 +402,19 @@ module storageAccount_blobServices 'blob-service/main.bicep' = if (!empty(blobSe
containers: contains(blobServices, 'containers') ? blobServices.containers : []
automaticSnapshotPolicyEnabled: contains(blobServices, 'automaticSnapshotPolicyEnabled') ? blobServices.automaticSnapshotPolicyEnabled : false
changeFeedEnabled: contains(blobServices, 'changeFeedEnabled') ? blobServices.changeFeedEnabled : false
changeFeedRetentionInDays: contains(blobServices, 'changeFeedRetentionInDays') ? blobServices.changeFeedRetentionInDays : 7
changeFeedRetentionInDays: blobServices.?changeFeedRetentionInDays
containerDeleteRetentionPolicyEnabled: contains(blobServices, 'containerDeleteRetentionPolicyEnabled') ? blobServices.containerDeleteRetentionPolicyEnabled : false
containerDeleteRetentionPolicyDays: contains(blobServices, 'containerDeleteRetentionPolicyDays') ? blobServices.containerDeleteRetentionPolicyDays : 7
containerDeleteRetentionPolicyDays: blobServices.?containerDeleteRetentionPolicyDays
containerDeleteRetentionPolicyAllowPermanentDelete: contains(blobServices, 'containerDeleteRetentionPolicyAllowPermanentDelete') ? blobServices.containerDeleteRetentionPolicyAllowPermanentDelete : false
corsRules: contains(blobServices, 'corsRules') ? blobServices.corsRules : []
defaultServiceVersion: contains(blobServices, 'defaultServiceVersion') ? blobServices.defaultServiceVersion : ''
deleteRetentionPolicyAllowPermanentDelete: contains(blobServices, 'deleteRetentionPolicyAllowPermanentDelete') ? blobServices.deleteRetentionPolicyAllowPermanentDelete : false
deleteRetentionPolicyEnabled: contains(blobServices, 'deleteRetentionPolicyEnabled') ? blobServices.deleteRetentionPolicyEnabled : false
deleteRetentionPolicyDays: contains(blobServices, 'deleteRetentionPolicyDays') ? blobServices.deleteRetentionPolicyDays : 7
deleteRetentionPolicyDays: blobServices.?deleteRetentionPolicyDays
isVersioningEnabled: contains(blobServices, 'isVersioningEnabled') ? blobServices.isVersioningEnabled : false
lastAccessTimeTrackingPolicyEnabled: contains(blobServices, 'lastAccessTimeTrackingPolicyEnabled') ? blobServices.lastAccessTimeTrackingPolicyEnabled : false
restorePolicyEnabled: contains(blobServices, 'restorePolicyEnabled') ? blobServices.restorePolicyEnabled : false
restorePolicyDays: contains(blobServices, 'restorePolicyDays') ? blobServices.restorePolicyDays : 6
restorePolicyDays: blobServices.?restorePolicyDays
diagnosticSettings: blobServices.?diagnosticSettings
enableDefaultTelemetry: enableReferencedModulesTelemetry
}
Expand Down
Loading
Loading