Skip to content

Commit

Permalink
feat: avm/res/dev-ops-infrastructure/pool implement latest AVM UDT …
Browse files Browse the repository at this point in the history
…standards (#3818)

## Description

This pull request implements the latest AVM standards regarding UDT's.

Tagging module owners: @surajguptha @elizatargithub7 

## Pipeline Reference

<!-- Insert your Pipeline Status Badge below -->

| Pipeline |
| -------- |
|
[![avm.res.dev-ops-infrastructure.pool](https://github.com/johnlokerse/bicep-registry-modules/actions/workflows/avm.res.dev-ops-infrastructure.pool.yml/badge.svg?branch=johnlokerse%2Fmdp-avm-wow)](https://github.com/johnlokerse/bicep-registry-modules/actions/workflows/avm.res.dev-ops-infrastructure.pool.yml)
|

## Type of Change

<!-- Use the checkboxes [x] on the options that are relevant. -->

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [x] Azure Verified Module updates:
- [ ] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [ ] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [x] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [x] Update to documentation

## Checklist

- [x] I'm sure there are no other open Pull Requests for the same
update/change
- [x] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [x] My corresponding pipelines / checks run clean and green without
any errors or warnings

<!-- Please keep up to date with the contribution guide at
https://aka.ms/avm/contribute/bicep -->
  • Loading branch information
johnlokerse authored Nov 24, 2024
1 parent 7efbdbf commit d8dc957
Show file tree
Hide file tree
Showing 4 changed files with 365 additions and 465 deletions.
17 changes: 13 additions & 4 deletions avm/res/dev-ops-infrastructure/pool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This module deploys the Managed DevOps Pool resource.
- [Usage examples](#Usage-examples)
- [Parameters](#Parameters)
- [Outputs](#Outputs)
- [Cross-referenced modules](#Cross-referenced-modules)
- [Notes](#Notes)
- [Data Collection](#Data-Collection)

Expand Down Expand Up @@ -939,7 +940,7 @@ The diagnostic settings of the service.
| [`logCategoriesAndGroups`](#parameter-diagnosticsettingslogcategoriesandgroups) | array | The name of logs that will be streamed. "allLogs" includes all possible logs for the resource. Set to `[]` to disable log collection. |
| [`marketplacePartnerResourceId`](#parameter-diagnosticsettingsmarketplacepartnerresourceid) | string | The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs. |
| [`metricCategories`](#parameter-diagnosticsettingsmetriccategories) | array | The name of metrics that will be streamed. "allMetrics" includes all possible metrics for the resource. Set to `[]` to disable metric collection. |
| [`name`](#parameter-diagnosticsettingsname) | string | The name of diagnostic setting. |
| [`name`](#parameter-diagnosticsettingsname) | string | The name of the diagnostic setting. |
| [`storageAccountResourceId`](#parameter-diagnosticsettingsstorageaccountresourceid) | string | Resource ID of the diagnostic storage account. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub. |
| [`workspaceResourceId`](#parameter-diagnosticsettingsworkspaceresourceid) | string | Resource ID of the diagnostic log analytics workspace. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub. |

Expand Down Expand Up @@ -1049,7 +1050,7 @@ Enable or disable the category explicitly. Default is `true`.

### Parameter: `diagnosticSettings.name`

The name of diagnostic setting.
The name of the diagnostic setting.

- Required: No
- Type: string
Expand Down Expand Up @@ -1144,7 +1145,7 @@ The managed service identities assigned to this resource.
| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`systemAssigned`](#parameter-managedidentitiessystemassigned) | bool | Enables system assigned managed identity on the resource. |
| [`userAssignedResourceIds`](#parameter-managedidentitiesuserassignedresourceids) | array | The resource ID(s) to assign to the resource. |
| [`userAssignedResourceIds`](#parameter-managedidentitiesuserassignedresourceids) | array | The resource ID(s) to assign to the resource. Required if a user assigned identity is used for encryption. |

### Parameter: `managedIdentities.systemAssigned`

Expand All @@ -1155,7 +1156,7 @@ Enables system assigned managed identity on the resource.

### Parameter: `managedIdentities.userAssignedResourceIds`

The resource ID(s) to assign to the resource.
The resource ID(s) to assign to the resource. Required if a user assigned identity is used for encryption.

- Required: No
- Type: array
Expand Down Expand Up @@ -1462,6 +1463,14 @@ Tags of the resource.
| `resourceId` | string | The resource ID of the Managed DevOps Pool. |
| `systemAssignedMIPrincipalId` | string | The principal ID of the system assigned identity. |

## Cross-referenced modules

This section gives you an overview of all local-referenced module files (i.e., other modules that are referenced in this module) and all remote-referenced files (i.e., Bicep modules that are referenced from a Bicep Registry or Template Specs).

| Reference | Type |
| :-- | :-- |
| `br/public:avm/utl/types/avm-common-types:0.3.0` | Remote reference |

## Notes

The Managed DevOps Pool resource requires external permissions in Azure DevOps. Make sure that the deployment principal has permission in Azure DevOps: [Managed DevOps Pools - Verify Azure DevOps Permissions](https://learn.microsoft.com/en-us/azure/devops/managed-devops-pools/prerequisites?view=azure-devops&tabs=azure-portal#verify-azure-devops-permissions)
Expand Down
160 changes: 39 additions & 121 deletions avm/res/dev-ops-infrastructure/pool/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ metadata name = 'Managed DevOps Pool'
metadata description = 'This module deploys the Managed DevOps Pool resource.'
metadata owner = 'Azure/module-maintainers'

// ============ //
// Parameters //
// ============ //

@description('Required. Name of the pool. It needs to be globally unique.')
param name string

Expand Down Expand Up @@ -38,7 +42,7 @@ param osProfile osProfileType = {
}

@description('Optional. The storage profile of the machines in the pool.')
param storageProfile storageProfileType
param storageProfile storageProfileType?

@description('Required. Defines the organization in which the pool will be used.')
param organizationProfile organizationProfileType
Expand All @@ -47,16 +51,19 @@ param organizationProfile organizationProfileType
param tags object?

@description('Optional. The lock settings of the service.')
param lock lockType
param lock lockType?
import { lockType } from 'br/public:avm/utl/types/avm-common-types:0.3.0'

@description('Optional. Array of role assignments to create.')
param roleAssignments roleAssignmentType
param roleAssignments roleAssignmentType[]?
import { roleAssignmentType } from 'br/public:avm/utl/types/avm-common-types:0.3.0'

@description('Optional. Enable/Disable usage telemetry for module.')
param enableTelemetry bool = true

@description('Optional. The diagnostic settings of the service.')
param diagnosticSettings diagnosticSettingType
param diagnosticSettings diagnosticSettingFullType[]?
import { diagnosticSettingFullType } from 'br/public:avm/utl/types/avm-common-types:0.3.0'

@description('Optional. The managed service identities assigned to this resource.')
@metadata({
Expand All @@ -72,7 +79,8 @@ param diagnosticSettings diagnosticSettingType
}
'''
})
param managedIdentities managedIdentitiesType
param managedIdentities managedIdentityAllType?
import { managedIdentityAllType } from 'br/public:avm/utl/types/avm-common-types:0.3.0'

var builtInRoleNames = {
Contributor: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')
Expand Down Expand Up @@ -127,6 +135,10 @@ var formattedDaysData = !empty(agentProfile.?resourcePredictions.?daysData)
)
: null

// ============== //
// Resources //
// ============== //

#disable-next-line no-deployments-resources
resource avmTelemetry 'Microsoft.Resources/deployments@2024-03-01' = if (enableTelemetry) {
name: '46d3xbcp.res.devopsinfrastructure-pool.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
Expand Down Expand Up @@ -256,6 +268,10 @@ resource managedDevOpsPool_diagnosticSettings 'Microsoft.Insights/diagnosticSett
}
]

// ============ //
// Outputs //
// ============ //

@description('The name of the Managed DevOps Pool.')
output name string = managedDevOpsPool.name

Expand All @@ -271,6 +287,10 @@ output location string = managedDevOpsPool.location
@description('The principal ID of the system assigned identity.')
output systemAssignedMIPrincipalId string? = managedDevOpsPool.?identity.?principalId

// =============== //
// Definitions //
// =============== //

@export()
type osProfileType = {
@description('Required. The logon type of the machine.')
Expand All @@ -295,20 +315,8 @@ type storageProfileType = {
osDiskStorageAccountType: ('Premium' | 'StandardSSD' | 'Standard')?

@description('Optional. A list of empty data disks to attach.')
dataDisks: {
@description('Optional. The type of caching to be enabled for the data disks. The default value for caching is readwrite. For information about the caching options see: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/.')
caching: ('None' | 'ReadOnly' | 'ReadWrite')?

@description('Optional. The initial disk size in gigabytes.')
diskSizeGiB: int?

@description('Optional. The drive letter for the empty data disk. If not specified, it will be the first available letter. Letters A, C, D, and E are not allowed.')
driveLetter: string?

@description('Optional. The storage Account type to be used for the data disk. If omitted, the default is Standard_LRS.')
storageAccountType: ('Premium_LRS' | 'Premium_ZRS' | 'StandardSSD_LRS' | 'StandardSSD_ZRS' | 'Standard_LRS')?
}[]?
}?
dataDisks: dataDiskType[]?
}

@export()
type imageType = {
Expand Down Expand Up @@ -370,7 +378,7 @@ type dataDiskType = {

@description('Optional. The storage Account type to be used for the data disk. If omitted, the default is Standard_LRS.')
storageAccountType: ('Premium_LRS' | 'Premium_ZRS' | 'StandardSSD_LRS' | 'StandardSSD_ZRS' | 'Standard_LRS')?
}[]?
}

@export()
type resourcePredictionsProfileAutomaticType = {
Expand Down Expand Up @@ -404,7 +412,7 @@ type agentStatefulType = {
timeZone: string

@description('Optional. The number of agents needed at a specific time.')
daysData: daysDataType
daysData: daysDataType?
}?

@discriminator('kind')
Expand All @@ -423,7 +431,7 @@ type agentStatelessType = {
timeZone: string

@description('Optional. The number of agents needed at a specific time.')
daysData: daysDataType
daysData: daysDataType?
}?

@discriminator('kind')
Expand All @@ -435,96 +443,6 @@ type agentStatelessType = {
@export()
type agentProfileType = agentStatefulType | agentStatelessType

@export()
type roleAssignmentType = {
@description('Optional. The name (as GUID) of the role assignment. If not provided, a GUID will be generated.')
name: string?

@description('Required. The role to assign. You can provide either the display name of the role definition, the role definition GUID, or its fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'.')
roleDefinitionIdOrName: string

@description('Required. The principal ID of the principal (user/group/identity) to assign the role to.')
principalId: string

@description('Optional. The principal type of the assigned principal ID.')
principalType: ('ServicePrincipal' | 'Group' | 'User' | 'ForeignGroup' | 'Device')?

@description('Optional. The description of the role assignment.')
description: string?

@description('Optional. The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase "foo_storage_container".')
condition: string?

@description('Optional. Version of the condition.')
conditionVersion: '2.0'?

@description('Optional. The Resource Id of the delegated managed identity resource.')
delegatedManagedIdentityResourceId: string?
}[]?

@export()
type lockType = {
@description('Optional. Specify the name of lock.')
name: string?

@description('Optional. Specify the type of lock.')
kind: ('CanNotDelete' | 'ReadOnly' | 'None')?
}?

@export()
type diagnosticSettingType = {
@description('Optional. The name of diagnostic setting.')
name: string?

@description('Optional. The name of logs that will be streamed. "allLogs" includes all possible logs for the resource. Set to `[]` to disable log collection.')
logCategoriesAndGroups: {
@description('Optional. Name of a Diagnostic Log category for a resource type this setting is applied to. Set the specific logs to collect here.')
category: string?

@description('Optional. Name of a Diagnostic Log category group for a resource type this setting is applied to. Set to `allLogs` to collect all logs.')
categoryGroup: string?

@description('Optional. Enable or disable the category explicitly. Default is `true`.')
enabled: bool?
}[]?

@description('Optional. The name of metrics that will be streamed. "allMetrics" includes all possible metrics for the resource. Set to `[]` to disable metric collection.')
metricCategories: {
@description('Required. Name of a Diagnostic Metric category for a resource type this setting is applied to. Set to `AllMetrics` to collect all metrics.')
category: string

@description('Optional. Enable or disable the category explicitly. Default is `true`.')
enabled: bool?
}[]?

@description('Optional. A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type.')
logAnalyticsDestinationType: ('Dedicated' | 'AzureDiagnostics')?

@description('Optional. Resource ID of the diagnostic log analytics workspace. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub.')
workspaceResourceId: string?

@description('Optional. Resource ID of the diagnostic storage account. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub.')
storageAccountResourceId: string?

@description('Optional. Resource ID of the diagnostic event hub authorization rule for the Event Hubs namespace in which the event hub should be created or streamed to.')
eventHubAuthorizationRuleResourceId: string?

@description('Optional. Name of the diagnostic event hub within the namespace to which logs are streamed. Without this, an event hub is created for each log category. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub.')
eventHubName: string?

@description('Optional. The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs.')
marketplacePartnerResourceId: string?
}[]?

@export()
type managedIdentitiesType = {
@description('Optional. Enables system assigned managed identity on the resource.')
systemAssigned: bool?

@description('Optional. The resource ID(s) to assign to the resource.')
userAssignedResourceIds: string[]?
}?

@export()
type standbyAgentsConfigType = {
@description('Required. The time at which the agents are needed.')
Expand All @@ -538,28 +456,28 @@ type standbyAgentsConfigType = {

@description('Required. The number of agents needed at the end time.')
endAgentCount: int
}?
}

@export()
type daysDataType = {
@description('Optional. The number of agents needed at a specific time for Monday.')
monday: standbyAgentsConfigType
monday: standbyAgentsConfigType?

@description('Optional. The number of agents needed at a specific time for Tuesday.')
tuesday: standbyAgentsConfigType
tuesday: standbyAgentsConfigType?

@description('Optional. The number of agents needed at a specific time for Wednesday.')
wednesday: standbyAgentsConfigType
wednesday: standbyAgentsConfigType?

@description('Optional. The number of agents needed at a specific time for Thursday.')
thursday: standbyAgentsConfigType
thursday: standbyAgentsConfigType?

@description('Optional. The number of agents needed at a specific time for Friday.')
friday: standbyAgentsConfigType
friday: standbyAgentsConfigType?

@description('Optional. The number of agents needed at a specific time for Saturday.')
saturday: standbyAgentsConfigType
saturday: standbyAgentsConfigType?

@description('Optional. The number of agents needed at a specific time for Sunday.')
sunday: standbyAgentsConfigType
}?
sunday: standbyAgentsConfigType?
}
Loading

0 comments on commit d8dc957

Please sign in to comment.