From 6dc2977641e6b724f504bf5f17985def487458db Mon Sep 17 00:00:00 2001 From: Dan Rios <36534747+riosengineer@users.noreply.github.com> Date: Sat, 10 Aug 2024 19:47:18 +0100 Subject: [PATCH] AVM Module Updates Updating code for AVM module references from old public registry --- bicep-examples/conditions/main.bicep | 4 ++-- bicep-examples/consuming-modules/modules.bicep | 12 ++++++------ bicep-examples/dependencies/main.bicep | 6 +++--- .../scoped-deployments/management-scope.bicep | 6 +++++- .../scoped-deployments/subscription-scope.bicep | 4 ++-- bicep-examples/test-framework/main.bicep | 6 +++++- bicep-examples/test-framework/main.bicepparam | 4 +--- bicep-examples/test-framework/tests.bicep | 2 ++ 8 files changed, 26 insertions(+), 18 deletions(-) diff --git a/bicep-examples/conditions/main.bicep b/bicep-examples/conditions/main.bicep index 37227a8..faec204 100644 --- a/bicep-examples/conditions/main.bicep +++ b/bicep-examples/conditions/main.bicep @@ -24,12 +24,12 @@ param kvEnv string = 'prod' // Environment variable for Key Vault SKU else if var kvSku = kvEnv == 'prod' ? 'premium' : 'standard' -module KeyVault 'br/public:security/keyvault:1.0.2' = if (deployResource) { +module KeyVault 'br/public:avm/res/key-vault/vault:0.7.0' = if (deployResource) { name: '${uniqueString(deployment().name, location)}-${kvName}' params: { name: kvName location: location - skuName: kvSku + sku: kvSku enableSoftDelete: true } } diff --git a/bicep-examples/consuming-modules/modules.bicep b/bicep-examples/consuming-modules/modules.bicep index f4292cf..cc24419 100644 --- a/bicep-examples/consuming-modules/modules.bicep +++ b/bicep-examples/consuming-modules/modules.bicep @@ -1,11 +1,11 @@ -// Rios Engineer - Public Bicep Registry Example -module public_registry 'br/public:compute/function-app:2.0.1' = { - name: 'public_registry_example' +// Rios Engineer - Public Bicep Registry Example (Azure Verified Modules) +module KeyVault 'br/public:avm/res/key-vault/vault:0.7.0' = { + name: 'avm_exmple' params: { - name: 'example-func-001' + name: 'kvName' location: 'uksouth' - storageAccountName: 'stsomestorageaccount001' - storageAccountResourceGroup: 'rg-some-rg-here' + sku: 'standard' + enableSoftDelete: true } } diff --git a/bicep-examples/dependencies/main.bicep b/bicep-examples/dependencies/main.bicep index 8d9d83c..9f273b5 100644 --- a/bicep-examples/dependencies/main.bicep +++ b/bicep-examples/dependencies/main.bicep @@ -42,7 +42,7 @@ var frontDoorRouteName = 'webapp-route' // Azure App Service components // vNet for integration -module vnet 'br/public:network/virtual-network:1.1.3' = { +module vnet 'br/public:avm/res/network/virtual-network:0.2.0' = { name: '${uniqueString(deployment().name, location)}-webVnet' scope: resourceGroup(workloadsSubId, rg_web_workload) params: { @@ -68,7 +68,7 @@ module vnet 'br/public:network/virtual-network:1.1.3' = { } // Log Analytics workspace -module logAnalytics 'br/public:storage/log-analytics-workspace:1.0.3' = { +module logAnalytics 'br/public:avm/res/operational-insights/workspace:0.5.0' = { name: '${uniqueString(deployment().name, location)}-ala' scope: resourceGroup(rg_web_workload) params: { @@ -84,7 +84,7 @@ module appInsights 'modules/appInsights/appinsights.bicep' = { params: { name: appInsightsName location: location - workspaceResourceId: logAnalytics.outputs.id + workspaceResourceId: logAnalytics.outputs.logAnalyticsWorkspaceId kind: 'web' applicationType: 'web' } diff --git a/bicep-examples/scoped-deployments/management-scope.bicep b/bicep-examples/scoped-deployments/management-scope.bicep index 5c1622a..8fcc1f1 100644 --- a/bicep-examples/scoped-deployments/management-scope.bicep +++ b/bicep-examples/scoped-deployments/management-scope.bicep @@ -9,11 +9,15 @@ param location string = 'uksouth' @description('Subscription Id.') param subId string = 'subscription-guid-here' +@description('Storage Account name.') +param stName string = 'stname0001' + // Deploy Storage Account to existing resource group in a subscription from management scope -module st_deploy 'br/public:storage/storage-account:3.0.1' = { +module st_deploy 'br/public:avm/res/storage/storage-account:0.11.1' = { scope: resourceGroup(subId, rg) name: 'st_deploy' params:{ + name: stName kind: 'StorageV2' location: location } diff --git a/bicep-examples/scoped-deployments/subscription-scope.bicep b/bicep-examples/scoped-deployments/subscription-scope.bicep index da61117..2c1f7d8 100644 --- a/bicep-examples/scoped-deployments/subscription-scope.bicep +++ b/bicep-examples/scoped-deployments/subscription-scope.bicep @@ -15,7 +15,7 @@ location: location // Deploy storage account to newly created resource group -module st_deploy 'br/public:storage/storage-account:3.0.1' = { +module st_deploy 'br/public:avm/res/storage/storage-account:0.11.1' = { scope: rg_deploy name: 'storageDeployment' params:{ @@ -25,7 +25,7 @@ module st_deploy 'br/public:storage/storage-account:3.0.1' = { // Deploy storage account to existing resource group in a subscription, without changing target scope -module st_deploy2 'br/public:storage/storage-account:3.0.1' = { +module st_deploy2 'br/public:avm/res/storage/storage-account:0.11.1' = { scope: resourceGroup('subscription-guid-here', 'rg-name-here') name: 'storageDeployment' params:{ diff --git a/bicep-examples/test-framework/main.bicep b/bicep-examples/test-framework/main.bicep index 34e0844..0f8c5c9 100644 --- a/bicep-examples/test-framework/main.bicep +++ b/bicep-examples/test-framework/main.bicep @@ -7,10 +7,14 @@ param location string @description('Storage account resource SKU.') param kind string +@description('Storage account name.') +param stName string + // Storage Account -module storage 'br/public:storage/storage-account:3.0.1' = { +module storage 'br/public:avm/res/storage/storage-account:0.11.1' = { name: 'storage_deploy' params:{ + name: stName kind: kind location: location } diff --git a/bicep-examples/test-framework/main.bicepparam b/bicep-examples/test-framework/main.bicepparam index 3d3b4b8..27c5992 100644 --- a/bicep-examples/test-framework/main.bicepparam +++ b/bicep-examples/test-framework/main.bicepparam @@ -1,7 +1,5 @@ using './main.bicep' -@description('Deployment location for resources.') param location = 'uksouth' - -@description('Storage account resource SKU.') param kind = 'storageV2' +param stName = 'stbicepifydemo001' diff --git a/bicep-examples/test-framework/tests.bicep b/bicep-examples/test-framework/tests.bicep index 45bb091..aeb161d 100644 --- a/bicep-examples/test-framework/tests.bicep +++ b/bicep-examples/test-framework/tests.bicep @@ -1,6 +1,7 @@ // Rios Engineer - Bicep Test Framework test mainTest 'main.bicep' = { params: { + stName: 'stbicepifydemo001' kind: 'storageV2' location: 'uksouth' } @@ -8,6 +9,7 @@ test mainTest 'main.bicep' = { test mainTestFail 'main.bicep' = { params: { + stName: 'stbicepifydemo001' kind: 'BlobStorage' location: 'northeurope' }