Skip to content
New issue

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

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

Already on GitHub? # to your account

Align locks accross all modules #197

Merged
merged 8 commits into from
Oct 19, 2021
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
16 changes: 11 additions & 5 deletions arm/Microsoft.AnalysisServices/servers/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ param eventHubAuthorizationRuleId string = ''
@description('Optional. Name of the event hub within the namespace to which logs are streamed. Without this, an event hub is created for each log category.')
param eventHubName string = ''

@description('Optional. Switch to lock Key Vault from deletion.')
param lockForDeletion bool = false
@allowed([
'CanNotDelete'
'NotSpecified'
'ReadOnly'
])
@description('Optional. Specify the type of lock.')
param lock string = 'NotSpecified'

@description('Optional. 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\'')
param roleAssignments array = []
Expand Down Expand Up @@ -115,10 +120,11 @@ resource server 'Microsoft.AnalysisServices/servers@2017-08-01' = {
}
}

resource server_lock 'Microsoft.Authorization/locks@2016-09-01' = if (lockForDeletion) {
name: '${server.name}-DoNotDelete'
resource server_lock 'Microsoft.Authorization/locks@2016-09-01' = if (lock != 'NotSpecified') {
name: '${server.name}-${lock}-lock'
properties: {
level: 'CanNotDelete'
level: lock
notes: (lock == 'CanNotDelete') ? 'Cannot delete resource or child resources.' : 'Cannot modify the resource or child resources.'
}
scope: server
}
Expand Down
Binary file modified arm/Microsoft.AnalysisServices/servers/readme.md
Binary file not shown.
16 changes: 11 additions & 5 deletions arm/Microsoft.ApiManagement/service/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,13 @@ param identityProviderType string = 'aad'
@description('Optional. Location for all Resources.')
param location string = resourceGroup().location

@description('Optional. Switch to lock Key Vault from deletion.')
param lockForDeletion bool = false
@allowed([
'CanNotDelete'
'NotSpecified'
'ReadOnly'
])
@description('Optional. Specify the type of lock.')
param lock string = 'NotSpecified'

@description('Optional. Limit control plane API calls to API Management service with version equal to or newer than this value.')
param minApiVersion string = ''
Expand Down Expand Up @@ -248,10 +253,11 @@ resource apiManagementService 'Microsoft.ApiManagement/service@2020-12-01' = {
}
}

resource apiManagementService_lock 'Microsoft.Authorization/locks@2016-09-01' = if (lockForDeletion) {
name: '${apiManagementService.name}-apiManagementServiceDoNotDelete'
resource apiManagementService_lock 'Microsoft.Authorization/locks@2016-09-01' = if (lock != 'NotSpecified') {
name: '${apiManagementService.name}-${lock}-lock'
properties: {
level: 'CanNotDelete'
level: lock
notes: (lock == 'CanNotDelete') ? 'Cannot delete resource or child resources.' : 'Cannot modify the resource or child resources.'
}
scope: apiManagementService
}
Expand Down
Binary file modified arm/Microsoft.ApiManagement/service/readme.md
Binary file not shown.
16 changes: 11 additions & 5 deletions arm/Microsoft.Automation/automationAccounts/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ param eventHubAuthorizationRuleId string = ''
@description('Optional. Name of the event hub within the namespace to which logs are streamed. Without this, an event hub is created for each log category.')
param eventHubName string = ''

@description('Optional. Switch to lock Automation Account from deletion.')
param lockForDeletion bool = false
@allowed([
'CanNotDelete'
'NotSpecified'
'ReadOnly'
])
@description('Optional. Specify the type of lock.')
param lock string = 'NotSpecified'

@description('Optional. 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\'')
param roleAssignments array = []
Expand Down Expand Up @@ -202,10 +207,11 @@ resource automationAccount 'Microsoft.Automation/automationAccounts@2020-01-13-p
}]
}

resource automationAccount_lock 'Microsoft.Authorization/locks@2016-09-01' = if (lockForDeletion) {
name: '${automationAccount.name}-DoNotDelete'
resource automationAccount_lock 'Microsoft.Authorization/locks@2016-09-01' = if (lock != 'NotSpecified') {
name: '${automationAccount.name}-${lock}-lock'
properties: {
level: 'CanNotDelete'
level: lock
notes: (lock == 'CanNotDelete') ? 'Cannot delete resource or child resources.' : 'Cannot modify the resource or child resources.'
}
scope: automationAccount
}
Expand Down
92 changes: 1 addition & 91 deletions arm/Microsoft.Automation/automationAccounts/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,41 +37,11 @@ This module deploys an Azure Automation Account, with resource lock.
| `privateEndpoints` | array | System.Object[] | | Optional. Configuration Details for private endpoints. |
| `eventHubAuthorizationRuleId` | string | | | Optional. Resource ID of the event hub authorization rule for the Event Hubs namespace in which the event hub should be created or streamed to. |
| `eventHubName` | string | | | Optional. Name of the event hub within the namespace to which logs are streamed. Without this, an event hub is created for each log category. |
| `lockForDeletion` | bool | `false` | | Optional. Switch to lock Automation Account from deletion. |
| `lock` | string | 'NotSpecified' | 'CanNotDelete', 'NotSpecified', 'ReadOnly' | Optional. Specify the type of lock |
| `roleAssignments` | array | [] | Complex structure, see below. | Optional. 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 it's fully qualified ID in the following format: '/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11' |
| `tags` | object | | | Optional. Tags of the Automation Account resource. |
| `sasTokenValidityLength` | string | PT8H | | Optional. SAS token validity length. Usage: 'PT8H' - valid for 8 hours; 'P5D' - valid for 5 days; 'P1Y' - valid for 1 year. When not provided, the SAS token will be valid for 8 hours. |

### Parameter Usage: `automationAccountName`

Name of the Azure Automation Account

```json
"automationAccountName": {
"value": "avd-scaling-autoaccount"
}
```

### Parameter Usage: `location`

Location for all resources.

```json
"location": {
"value": "westeurope"
}
```

### Parameter Usage: `skuName`

Specifies the SKU for the Automation Account

```json
"skuName": {
"value": "Basic"
}
```

### Parameter Usage: `modules`

List of modules to be created in the automation account
Expand Down Expand Up @@ -187,66 +157,6 @@ To use Private Endpoint the following dependencies must be deployed:
}
```

### Parameter Usage: `diagnosticLogsRetentionInDays`

Specifies the number of days that logs will be kept for; a value of 0 will retain data indefinitely.

```json
"diagnosticLogsRetentionInDays": {
"value": 30
}
```

### Parameter Usage: `diagnosticStorageAccountId`

Resource identifier of the Diagnostic Storage Account.

```json
"diagnosticStorageAccountId": {
"value": "/subscriptions/396826c76-d304-46d8-a0f6-718dbded536c/resourceGroups/Base-RG/providers/Microsoft.Storage/storageAccounts/sharedSA"
}
```

### Parameter Usage: `workspaceId`

Resource identifier of Log Analytics.

```json
"workspaceId": {
"value": "/subscriptions/396826c76-d304-46d8-a0f6-718dbded536c/resourceGroups/Base-RG/providers/microsoft.operationalinsights/workspaces/my-sbx-eu-la"
}
```

### Parameter Usage: `eventHubAuthorizationRuleId`

Resource ID of the event hub authorization rule for the Event Hubs namespace in which the event hub should be created or streamed to.

```json
"eventHubAuthorizationRuleId": {
"value": "/subscriptions/396826c76-d304-46d8-a0f6-718dbded536c/resourceGroups/Base-RG/providers/Microsoft.EventHub/namespaces/my-sbx-02-eh/authorizationRules/myRule"
}
```

### Parameter Usage: `eventHubName`

Name of the event hub within the namespace to which logs are streamed. Without this, an event hub is created for each log category.

```json
"eventHubName": {
"value": "myEventHub"
}
```

### Parameter Usage: `lockForDeletion`

Switch to lock Logic App from deletion.

```json
"lockForDeletion": {
"value": true
}
```

### Parameter Usage: `roleAssignments`

```json
Expand Down
16 changes: 11 additions & 5 deletions arm/Microsoft.Batch/batchAccounts/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ param eventHubAuthorizationRuleId string = ''
@description('Optional. Name of the event hub within the namespace to which logs are streamed. Without this, an event hub is created for each log category.')
param eventHubName string = ''

@description('Optional. Switch to lock Key Vault from deletion.')
param lockForDeletion bool = false
@allowed([
'CanNotDelete'
'NotSpecified'
'ReadOnly'
])
@description('Optional. Specify the type of lock.')
param lock string = 'NotSpecified'

@description('Optional. Tags of the resource.')
param tags object = {}
Expand Down Expand Up @@ -63,10 +68,11 @@ resource batchAccount 'Microsoft.Batch/batchAccounts@2020-09-01' = {
properties: {}
}

resource batchAccount_lock 'Microsoft.Authorization/locks@2016-09-01' = if (lockForDeletion) {
name: '${batchAccount.name}-doNotDelete'
resource batchAccount_lock 'Microsoft.Authorization/locks@2016-09-01' = if (lock != 'NotSpecified') {
name: '${batchAccount.name}-${lock}-lock'
properties: {
level: 'CanNotDelete'
level: lock
notes: (lock == 'CanNotDelete') ? 'Cannot delete resource or child resources.' : 'Cannot modify the resource or child resources.'
}
scope: batchAccount
}
Expand Down
2 changes: 1 addition & 1 deletion arm/Microsoft.Batch/batchAccounts/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The following resources are required to be able to deploy this resource.
| `eventHubAuthorizationRuleId` | string | Optional. Resource ID of the event hub authorization rule for the Event Hubs namespace in which the event hub should be created or streamed to. | | |
| `eventHubName` | string | Optional. Name of the event hub within the namespace to which logs are streamed. Without this, an event hub is created for each log category. | | |
| `location` | string | Optional. Location for all Resources. | [resourceGroup().location] | |
| `lockForDeletion` | bool | Optional. Switch to lock Key Vault from deletion. | False | |
| `lock` | string | Optional. Specify the type of lock. | 'NotSpecified' | 'CanNotDelete', 'NotSpecified', 'ReadOnly' |
| `tags` | object | Optional. Tags of the resource. | | |
| `workspaceId` | string | Optional. Resource identifier of Log Analytics. | | |

Expand Down
Loading