From dcf3b9dc92d5933d44ee3c6937e51ac3cd334cfb Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 19 Sep 2022 15:34:40 +0200 Subject: [PATCH 1/9] First commit --- utilities/tools/REST2CARML/Set-ModuleFolderData.ps1 | 1 + 1 file changed, 1 insertion(+) create mode 100644 utilities/tools/REST2CARML/Set-ModuleFolderData.ps1 diff --git a/utilities/tools/REST2CARML/Set-ModuleFolderData.ps1 b/utilities/tools/REST2CARML/Set-ModuleFolderData.ps1 new file mode 100644 index 0000000000..5f282702bb --- /dev/null +++ b/utilities/tools/REST2CARML/Set-ModuleFolderData.ps1 @@ -0,0 +1 @@ + \ No newline at end of file From ba0ce73835705cca9d99fd5eed36ee5ee1f706a8 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Tue, 20 Sep 2022 19:31:38 +0200 Subject: [PATCH 2/9] Updated Network Public IP Prefixes to new dependencies approach --- .../workflows/ms.network.publicipprefixes.yml | 3 +- .../.test/common/dependencies.bicep | 14 +++++ .../.test/common/deploy.test.bicep | 55 +++++++++++++++++++ .../.test/min/deploy.test.bicep | 37 +++++++++++++ .../publicIPPrefixes/.test/parameters.json | 25 --------- .../publicIPPrefixes/readme.md | 55 +++++++++++++++++-- 6 files changed, 156 insertions(+), 33 deletions(-) create mode 100644 modules/Microsoft.Network/publicIPPrefixes/.test/common/dependencies.bicep create mode 100644 modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep create mode 100644 modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep delete mode 100644 modules/Microsoft.Network/publicIPPrefixes/.test/parameters.json diff --git a/.github/workflows/ms.network.publicipprefixes.yml b/.github/workflows/ms.network.publicipprefixes.yml index 7dfc0f9c4c..864857fa8a 100644 --- a/.github/workflows/ms.network.publicipprefixes.yml +++ b/.github/workflows/ms.network.publicipprefixes.yml @@ -106,8 +106,7 @@ jobs: - name: 'Using test file [${{ matrix.moduleTestFilePaths }}]' uses: ./.github/actions/templates/validateModuleDeployment with: - templateFilePath: '${{ env.modulePath }}/deploy.bicep' - parameterFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}' + templateFilePath: '${{ env.modulePath }}/${{ matrix.moduleTestFilePaths }}' location: '${{ env.location }}' resourceGroupName: '${{ env.resourceGroupName }}' subscriptionId: '${{ secrets.ARM_SUBSCRIPTION_ID }}' diff --git a/modules/Microsoft.Network/publicIPPrefixes/.test/common/dependencies.bicep b/modules/Microsoft.Network/publicIPPrefixes/.test/common/dependencies.bicep new file mode 100644 index 0000000000..7371d4437b --- /dev/null +++ b/modules/Microsoft.Network/publicIPPrefixes/.test/common/dependencies.bicep @@ -0,0 +1,14 @@ +@description('Optional. The location to deploy to.') +param location string = resourceGroup().location + +@description('Required. The name of the Managed Identity to create.') +param managedIdentityName string + +resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { + name: managedIdentityName + location: location +} + +@description('The principal ID of the created Managed Identity.') +output managedIdentityPrincipalId string = managedIdentity.properties.principalId + diff --git a/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep b/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep new file mode 100644 index 0000000000..2b04648c86 --- /dev/null +++ b/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep @@ -0,0 +1,55 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.network.publicipprefixes-${serviceShort}-rg' + +@description('Optional. The location to deploy resources to') +param location string = deployment().location + +@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints') +param serviceShort string = 'npipcom' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: resourceGroupName + location: location +} + +module resourceGroupResources 'dependencies.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name, location)}-paramNested' + params: { + managedIdentityName: 'dep-<>-msi-${serviceShort}' + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + prefixLength: 28 + lock: 'CanNotDelete' + roleAssignments: [ + { + principalIds: [ + resourceGroupResources.outputs.managedIdentityPrincipalId + ] + roleDefinitionIdOrName: 'Reader' + } + ] + } +} diff --git a/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep b/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep new file mode 100644 index 0000000000..3d3b5a9416 --- /dev/null +++ b/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep @@ -0,0 +1,37 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.network.publicipprefixes-${serviceShort}-rg' + +@description('Optional. The location to deploy resources to') +param location string = deployment().location + +@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints') +param serviceShort string = 'npipmin' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: resourceGroupName + location: location +} +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + prefixLength: 28 + } +} diff --git a/modules/Microsoft.Network/publicIPPrefixes/.test/parameters.json b/modules/Microsoft.Network/publicIPPrefixes/.test/parameters.json deleted file mode 100644 index 4367694850..0000000000 --- a/modules/Microsoft.Network/publicIPPrefixes/.test/parameters.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-az-pippfx-x-001" - }, - "lock": { - "value": "CanNotDelete" - }, - "prefixLength": { - "value": 28 - }, - "roleAssignments": { - "value": [ - { - "roleDefinitionIdOrName": "Reader", - "principalIds": [ - "<>" - ] - } - ] - } - } -} diff --git a/modules/Microsoft.Network/publicIPPrefixes/readme.md b/modules/Microsoft.Network/publicIPPrefixes/readme.md index 1545c706c5..59251877ac 100644 --- a/modules/Microsoft.Network/publicIPPrefixes/readme.md +++ b/modules/Microsoft.Network/publicIPPrefixes/readme.md @@ -156,7 +156,7 @@ The following module usage examples are retrieved from the content of the files >**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order. -

Example 1: Parameters

+

Example 1: Common

@@ -164,17 +164,17 @@ The following module usage examples are retrieved from the content of the files ```bicep module publicIPPrefixes './Microsoft.Network/publicIPPrefixes/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-PublicIPPrefixes' + name: '${uniqueString(deployment().name)}-test-npipcom' params: { // Required parameters - name: '<>-az-pippfx-x-001' + name: '<>npipcom001' prefixLength: 28 // Non-required parameters lock: 'CanNotDelete' roleAssignments: [ { principalIds: [ - '<>' + '' ] roleDefinitionIdOrName: 'Reader' } @@ -197,7 +197,7 @@ module publicIPPrefixes './Microsoft.Network/publicIPPrefixes/deploy.bicep' = { "parameters": { // Required parameters "name": { - "value": "<>-az-pippfx-x-001" + "value": "<>npipcom001" }, "prefixLength": { "value": 28 @@ -210,7 +210,7 @@ module publicIPPrefixes './Microsoft.Network/publicIPPrefixes/deploy.bicep' = { "value": [ { "principalIds": [ - "<>" + "" ], "roleDefinitionIdOrName": "Reader" } @@ -222,3 +222,46 @@ module publicIPPrefixes './Microsoft.Network/publicIPPrefixes/deploy.bicep' = {

+ +

Example 2: Min

+ +
+ +via Bicep module + +```bicep +module publicIPPrefixes './Microsoft.Network/publicIPPrefixes/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-npipmin' + params: { + // Required parameters + name: '<>npipmin001' + prefixLength: 28 + } +} +``` + +
+

+ +

+ +via JSON Parameter file + +```json +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + // Required parameters + "name": { + "value": "<>npipmin001" + }, + "prefixLength": { + "value": 28 + } + } +} +``` + +
+

From aea3068ad7b494a2543440c6884bc189dc8c3a10 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Tue, 20 Sep 2022 22:25:59 +0200 Subject: [PATCH 3/9] Update to latest --- utilities/tools/REST2CARML/Set-ModuleFolderData.ps1 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 utilities/tools/REST2CARML/Set-ModuleFolderData.ps1 diff --git a/utilities/tools/REST2CARML/Set-ModuleFolderData.ps1 b/utilities/tools/REST2CARML/Set-ModuleFolderData.ps1 deleted file mode 100644 index 5f282702bb..0000000000 --- a/utilities/tools/REST2CARML/Set-ModuleFolderData.ps1 +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From 3a51873e321b89d57c1b132c9ab8b6defe54cf56 Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Wed, 5 Oct 2022 14:45:46 +0200 Subject: [PATCH 4/9] Update modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep Co-authored-by: Erika Gressi <56914614+eriqua@users.noreply.github.com> --- .../publicIPPrefixes/.test/common/deploy.test.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep b/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep index 2b04648c86..fd66355d33 100644 --- a/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep @@ -3,7 +3,7 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@description('Optional. The name of the resource group to deploy for testing purposes') +@description('Optional. The name of the resource group to deploy for testing purposes.') @maxLength(90) param resourceGroupName string = 'ms.network.publicipprefixes-${serviceShort}-rg' From dd9ce9f1612800e827c6e2070cb3c6c4ff851a60 Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Wed, 5 Oct 2022 14:45:51 +0200 Subject: [PATCH 5/9] Update modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep Co-authored-by: Erika Gressi <56914614+eriqua@users.noreply.github.com> --- .../publicIPPrefixes/.test/common/deploy.test.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep b/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep index fd66355d33..d3144e058a 100644 --- a/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep @@ -7,7 +7,7 @@ targetScope = 'subscription' @maxLength(90) param resourceGroupName string = 'ms.network.publicipprefixes-${serviceShort}-rg' -@description('Optional. The location to deploy resources to') +@description('Optional. The location to deploy resources to.') param location string = deployment().location @description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints') From 543f5f74e6adf513eea0026f2031af74d7f24652 Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Wed, 5 Oct 2022 14:45:56 +0200 Subject: [PATCH 6/9] Update modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep Co-authored-by: Erika Gressi <56914614+eriqua@users.noreply.github.com> --- .../publicIPPrefixes/.test/common/deploy.test.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep b/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep index d3144e058a..9a516f4612 100644 --- a/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep +++ b/modules/Microsoft.Network/publicIPPrefixes/.test/common/deploy.test.bicep @@ -10,7 +10,7 @@ param resourceGroupName string = 'ms.network.publicipprefixes-${serviceShort}-rg @description('Optional. The location to deploy resources to.') param location string = deployment().location -@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints') +@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.') param serviceShort string = 'npipcom' // =========== // From 2d3d2c324e77b8a15f8498576ffe0aa4fd3e6149 Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Wed, 5 Oct 2022 14:46:00 +0200 Subject: [PATCH 7/9] Update modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep Co-authored-by: Erika Gressi <56914614+eriqua@users.noreply.github.com> --- .../publicIPPrefixes/.test/min/deploy.test.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep b/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep index 3d3b5a9416..953b5ccc8c 100644 --- a/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep +++ b/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep @@ -3,7 +3,7 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@description('Optional. The name of the resource group to deploy for testing purposes') +@description('Optional. The name of the resource group to deploy for testing purposes.') @maxLength(90) param resourceGroupName string = 'ms.network.publicipprefixes-${serviceShort}-rg' From 3516e78e45799969406588c6759117dd580643bf Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Wed, 5 Oct 2022 14:46:06 +0200 Subject: [PATCH 8/9] Update modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep Co-authored-by: Erika Gressi <56914614+eriqua@users.noreply.github.com> --- .../publicIPPrefixes/.test/min/deploy.test.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep b/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep index 953b5ccc8c..82f66437f8 100644 --- a/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep +++ b/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep @@ -7,7 +7,7 @@ targetScope = 'subscription' @maxLength(90) param resourceGroupName string = 'ms.network.publicipprefixes-${serviceShort}-rg' -@description('Optional. The location to deploy resources to') +@description('Optional. The location to deploy resources to.') param location string = deployment().location @description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints') From 9c3ed9b58088d3efa6eed097238db70413f8f9f1 Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Wed, 5 Oct 2022 14:46:13 +0200 Subject: [PATCH 9/9] Update modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep Co-authored-by: Erika Gressi <56914614+eriqua@users.noreply.github.com> --- .../publicIPPrefixes/.test/min/deploy.test.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep b/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep index 82f66437f8..8ed5980da1 100644 --- a/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep +++ b/modules/Microsoft.Network/publicIPPrefixes/.test/min/deploy.test.bicep @@ -10,7 +10,7 @@ param resourceGroupName string = 'ms.network.publicipprefixes-${serviceShort}-rg @description('Optional. The location to deploy resources to.') param location string = deployment().location -@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints') +@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.') param serviceShort string = 'npipmin' // =========== //