From 703fbe0cba79fa2c6893a1150bda84dc59f58c59 Mon Sep 17 00:00:00 2001 From: Gordon Byers Date: Sun, 10 Sep 2023 11:07:27 +0000 Subject: [PATCH] api bumps and dev container spec --- .devcontainer/devcontainer.json | 33 +++++++++++++++++++++++++++++++++ bicep/ade.bicep | 12 ++++++------ bicep/aib-devboxdef.bicep | 8 ++++---- bicep/aib.bicep | 6 +++--- bicep/bicepconfig.json | 13 +++++++++++++ bicep/common.bicep | 4 ++-- bicep/devbox.bicep | 10 +++++----- bicep/devboxNetworking.bicep | 8 ++++---- bicep/devboxdef.bicep | 8 ++++---- bicep/devboxrbac.bicep | 2 +- bicep/keyvault.bicep | 4 ++-- 11 files changed, 77 insertions(+), 31 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 bicep/bicepconfig.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..50c3818 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,33 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu +{ + "name": "Ubuntu", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:jammy", + "features": { + "ghcr.io/devcontainers/features/azure-cli:1": {}, + "ghcr.io/devcontainers/features/powershell:1": {} + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-azuretools.vscode-bicep" + ] + } + } + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/bicep/ade.bicep b/bicep/ade.bicep index 403571a..6e65b61 100644 --- a/bicep/ade.bicep +++ b/bicep/ade.bicep @@ -11,11 +11,11 @@ param adeProjectUser string = '' @description('A PAT token is required, even for public repos') param catalogRepoPat string -resource dc 'Microsoft.DevCenter/devcenters@2022-11-11-preview' existing = { +resource dc 'Microsoft.DevCenter/devcenters@2023-04-01' existing = { name: devcenterName } -resource project 'Microsoft.DevCenter/projects@2022-11-11-preview' existing = { +resource project 'Microsoft.DevCenter/projects@2023-04-01' existing = { name: projectTeamName } @@ -46,12 +46,12 @@ module rbac 'devboxrbac.bicep' = { } } -resource env 'Microsoft.DevCenter/devcenters/environmentTypes@2022-11-11-preview' = { +resource env 'Microsoft.DevCenter/devcenters/environmentTypes@2023-04-01' = { name: environmentName parent: dc } -resource catalog 'Microsoft.DevCenter/devcenters/catalogs@2022-11-11-preview' = { +resource catalog 'Microsoft.DevCenter/devcenters/catalogs@2023-04-01' = { name: catalogName parent: dc properties: { @@ -65,7 +65,7 @@ resource catalog 'Microsoft.DevCenter/devcenters/catalogs@2022-11-11-preview' = } param environmentTypes array = ['Dev', 'Test', 'Staging'] -resource envs 'Microsoft.DevCenter/devcenters/environmentTypes@2022-11-11-preview' = [for envType in environmentTypes :{ +resource envs 'Microsoft.DevCenter/devcenters/environmentTypes@2023-04-01' = [for envType in environmentTypes :{ name: envType parent: dc }] @@ -80,7 +80,7 @@ var rbacRoleId = { } output dti string = deploymentTargetId -resource projectAssign 'Microsoft.DevCenter/projects/environmentTypes@2022-11-11-preview' = [for envType in environmentTypes : { +resource projectAssign 'Microsoft.DevCenter/projects/environmentTypes@2023-04-01' = [for envType in environmentTypes : { name: envType parent: project identity: { diff --git a/bicep/aib-devboxdef.bicep b/bicep/aib-devboxdef.bicep index 89b29f9..6d2eae5 100644 --- a/bicep/aib-devboxdef.bicep +++ b/bicep/aib-devboxdef.bicep @@ -8,21 +8,21 @@ param devcenterGalleryName string @allowed(['ssd_256gb', 'ssd_512gb', 'ssd_1024gb']) param storage string = 'ssd_256gb' -resource dc 'Microsoft.DevCenter/devcenters@2022-11-11-preview' existing = { +resource dc 'Microsoft.DevCenter/devcenters@2023-04-01' existing = { name: devcenterName } -resource dcGallery 'Microsoft.DevCenter/devcenters/galleries@2022-11-11-preview' existing = { +resource dcGallery 'Microsoft.DevCenter/devcenters/galleries@2023-04-01' existing = { name: devcenterGalleryName parent: dc } -resource galleryimage 'Microsoft.DevCenter/devcenters/galleries/images@2022-11-11-preview' existing = { +resource galleryimage 'Microsoft.DevCenter/devcenters/galleries/images@2023-04-01' existing = { name: imageName parent: dcGallery } -resource devboxdef 'Microsoft.DevCenter/devcenters/devboxdefinitions@2022-11-11-preview' = { +resource devboxdef 'Microsoft.DevCenter/devcenters/devboxdefinitions@2023-04-01' = { name: imageName parent: dc location: location diff --git a/bicep/aib.bicep b/bicep/aib.bicep index f51c224..1772f1e 100644 --- a/bicep/aib.bicep +++ b/bicep/aib.bicep @@ -6,11 +6,11 @@ param nameseed string = 'dbox' param devcenterName string -resource dc 'Microsoft.DevCenter/devcenters@2022-11-11-preview' existing = { +resource dc 'Microsoft.DevCenter/devcenters@2023-04-01' existing = { name: devcenterName } -resource dcGallery 'Microsoft.DevCenter/devcenters/galleries@2022-11-11-preview' = { +resource dcGallery 'Microsoft.DevCenter/devcenters/galleries@2023-04-01' = { name: 'ig${nameseed}' parent: dc properties: { @@ -95,7 +95,7 @@ var imageBuildName = take('${imageName}-${imageSkuVersion}_${newguid}_Build',64) @description('A unique string generated for each deployment, to make sure the script is always run.') param newguid string = newGuid() -resource templateIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2022-01-31-preview' = { +resource templateIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { name: 'id-${nameseed}' location: location } diff --git a/bicep/bicepconfig.json b/bicep/bicepconfig.json new file mode 100644 index 0000000..65ad552 --- /dev/null +++ b/bicep/bicepconfig.json @@ -0,0 +1,13 @@ +{ + // See https://aka.ms/bicep/config for more information on Bicep configuration options + // Press CTRL+SPACE/CMD+SPACE at any location to see Intellisense suggestions + "analyzers": { + "core": { + "rules": { + "use-recent-api-versions" : { + "level": "warning" + } + } + } + } +} \ No newline at end of file diff --git a/bicep/common.bicep b/bicep/common.bicep index eb5beb9..6f3eef7 100644 --- a/bicep/common.bicep +++ b/bicep/common.bicep @@ -8,7 +8,7 @@ param devboxProjectUser string @description('Provide the AzureAd UserId to assign project rbac for (get the current user with az ad signed-in-user show --query id)') param devboxProjectAdmin string = '' -resource dc 'Microsoft.DevCenter/devcenters@2022-11-11-preview' = { +resource dc 'Microsoft.DevCenter/devcenters@2023-04-01' = { name: 'dc-${nameseed}' location: location identity: { @@ -16,7 +16,7 @@ resource dc 'Microsoft.DevCenter/devcenters@2022-11-11-preview' = { } } -resource project 'Microsoft.DevCenter/projects@2022-11-11-preview' = { +resource project 'Microsoft.DevCenter/projects@2023-04-01' = { name: projectTeamName location: location properties: { diff --git a/bicep/devbox.bicep b/bicep/devbox.bicep index 399b482..56cf94e 100644 --- a/bicep/devbox.bicep +++ b/bicep/devbox.bicep @@ -19,11 +19,11 @@ var regionTimeZones = loadJsonContent('azure-region-lookup.json') @description('All locations, in one array') var allLocations = concat([location],extraLocations) -resource dc 'Microsoft.DevCenter/devcenters@2022-11-11-preview' existing = { +resource dc 'Microsoft.DevCenter/devcenters@2023-04-01' existing = { name: devcenterName } -resource project 'Microsoft.DevCenter/projects@2022-11-11-preview' existing = { +resource project 'Microsoft.DevCenter/projects@2023-04-01' existing = { name: projectTeamName } @@ -54,7 +54,7 @@ module networkingLocations 'devboxNetworking.bicep' = [for (loc, i) in allLocati } }] -resource win11ProjectPool 'Microsoft.DevCenter/projects/pools@2023-01-01-preview' = [ for (loc, i) in allLocations: { +resource win11ProjectPool 'Microsoft.DevCenter/projects/pools@2023-04-01' = [ for (loc, i) in allLocations: { name: '${projectTeamName}-win11plain-${loc}' location: location parent: project @@ -66,7 +66,7 @@ resource win11ProjectPool 'Microsoft.DevCenter/projects/pools@2023-01-01-preview } }] -resource vsProjectPool 'Microsoft.DevCenter/projects/pools@2023-01-01-preview' = [ for (loc, i) in allLocations: { +resource vsProjectPool 'Microsoft.DevCenter/projects/pools@2023-04-01' = [ for (loc, i) in allLocations: { name: '${projectTeamName}-vs2022-${loc}' location: location parent: project @@ -79,7 +79,7 @@ resource vsProjectPool 'Microsoft.DevCenter/projects/pools@2023-01-01-preview' = }] @description('This loop expression might look complex, but it is simply just creating a schedule for every pool in every region') -resource scheduleStop 'Microsoft.DevCenter/projects/pools/schedules@2023-01-01-preview' = [ for (loc, i) in allLocations: { +resource scheduleStop 'Microsoft.DevCenter/projects/pools/schedules@2023-04-01' = [ for (loc, i) in allLocations: { name: '${projectTeamName}/${projectTeamName}-${i % 2 == 0 ? 'win11plain' : 'vs2022'}-${loc}/default' dependsOn: [ win11ProjectPool[i] diff --git a/bicep/devboxNetworking.bicep b/bicep/devboxNetworking.bicep index 88df684..bd48285 100644 --- a/bicep/devboxNetworking.bicep +++ b/bicep/devboxNetworking.bicep @@ -9,11 +9,11 @@ param subnetAddress string = '10.0.0.0/24' @description('The name of a new resource group that will be created to store some Networking resources (like NICs) in') param networkingResourceGroupName string = '${resourceGroup().name}-networking-${location}' -resource dc 'Microsoft.DevCenter/devcenters@2022-11-11-preview' existing = { +resource dc 'Microsoft.DevCenter/devcenters@2023-04-01' existing = { name: devcenterName } -resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-07-01' = { +resource virtualNetwork 'Microsoft.Network/virtualNetworks@2023-05-01' = { name: 'vnet-${nameseed}-${location}' location: location properties: { @@ -33,7 +33,7 @@ resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-07-01' = { } } -resource networkconnection 'Microsoft.DevCenter/networkConnections@2022-11-11-preview' = { +resource networkconnection 'Microsoft.DevCenter/networkConnections@2023-04-01' = { name: 'con-${nameseed}-${location}' location: location properties: { @@ -43,7 +43,7 @@ resource networkconnection 'Microsoft.DevCenter/networkConnections@2022-11-11-pr } } -resource attachedNetwork 'Microsoft.DevCenter/devcenters/attachednetworks@2022-11-11-preview' = { +resource attachedNetwork 'Microsoft.DevCenter/devcenters/attachednetworks@2023-04-01' = { name: 'dcon-${nameseed}-${location}' parent: dc properties: { diff --git a/bicep/devboxdef.bicep b/bicep/devboxdef.bicep index ae67540..7022f2c 100644 --- a/bicep/devboxdef.bicep +++ b/bicep/devboxdef.bicep @@ -21,22 +21,22 @@ var defaultImageMap = { vs2022win11m365: 'microsoftvisualstudio_visualstudioplustools_vs-2022-ent-general-win11-m365-gen2' } -resource dc 'Microsoft.DevCenter/devcenters@2022-11-11-preview' existing = { +resource dc 'Microsoft.DevCenter/devcenters@2023-04-01' existing = { name: devcenterName } -resource gallery 'Microsoft.DevCenter/devcenters/galleries@2022-11-11-preview' existing = { +resource gallery 'Microsoft.DevCenter/devcenters/galleries@2023-04-01' existing = { name: galleryName parent: dc } -resource galleryimage 'Microsoft.DevCenter/devcenters/galleries/images@2022-11-11-preview' existing = { +resource galleryimage 'Microsoft.DevCenter/devcenters/galleries/images@2023-04-01' existing = { name: defaultImageMap['${image}'] parent: gallery } output imageGalleryId string = galleryimage.id -resource devboxdef 'Microsoft.DevCenter/devcenters/devboxdefinitions@2022-11-11-preview' = { +resource devboxdef 'Microsoft.DevCenter/devcenters/devboxdefinitions@2023-04-01' = { name: definitionName parent: dc location: location diff --git a/bicep/devboxrbac.bicep b/bicep/devboxrbac.bicep index a540ce7..d9a8ff1 100644 --- a/bicep/devboxrbac.bicep +++ b/bicep/devboxrbac.bicep @@ -2,7 +2,7 @@ param keyVaultName string param principalId string -resource kv 'Microsoft.KeyVault/vaults@2021-11-01-preview' existing = { +resource kv 'Microsoft.KeyVault/vaults@2023-02-01' existing = { name: keyVaultName } diff --git a/bicep/keyvault.bicep b/bicep/keyvault.bicep index 3a6283f..ed984e4 100644 --- a/bicep/keyvault.bicep +++ b/bicep/keyvault.bicep @@ -28,7 +28,7 @@ var kvIPRules = [for kvIp in keyVaultIPAllowlist: { value: kvIp }] -resource kv 'Microsoft.KeyVault/vaults@2021-11-01-preview' = { +resource kv 'Microsoft.KeyVault/vaults@2023-02-01' = { name: akvName location: location properties: { @@ -52,7 +52,7 @@ resource kv 'Microsoft.KeyVault/vaults@2021-11-01-preview' = { enabledForDiskEncryption: false enabledForTemplateDeployment: false enableSoftDelete: keyVaultSoftDelete - enablePurgeProtection: keyVaultPurgeProtection ? true : json('null') + enablePurgeProtection: keyVaultPurgeProtection ? true : null } }