From e4a6312c4bdea8dace8301166b1dabb2cab150dc Mon Sep 17 00:00:00 2001 From: MrMCake Date: Tue, 30 Aug 2022 20:52:17 +0200 Subject: [PATCH 1/8] [Modules] Updated Authorization/PolicyExemptions to new dependency approach --- .../ms.authorization.policyexemptions.yml | 3 +- .../.test/mg.min.parameters.json | 12 -- .../.test/mg.min/deploy.test.bicep | 37 ++++ .../policyExemptions/.test/mg.parameters.json | 29 --- .../.test/mg/deploy.test.bicep | 45 ++++ .../.test/rg.min.parameters.json | 18 -- .../.test/rg.min/deploy.test.bicep | 49 +++++ .../policyExemptions/.test/rg.parameters.json | 32 --- .../.test/rg/deploy.test.bicep | 55 +++++ .../.test/sub.min.parameters.json | 15 -- .../.test/sub.min/deploy.test.bicep | 38 ++++ .../.test/sub.parameters.json | 29 --- .../.test/sub/deploy.test.bicep | 44 ++++ .../policyExemptions/readme.md | 196 +++++++++--------- utilities/tools/Set-ModuleReadMe.ps1 | 6 +- 15 files changed, 370 insertions(+), 238 deletions(-) delete mode 100644 modules/Microsoft.Authorization/policyExemptions/.test/mg.min.parameters.json create mode 100644 modules/Microsoft.Authorization/policyExemptions/.test/mg.min/deploy.test.bicep delete mode 100644 modules/Microsoft.Authorization/policyExemptions/.test/mg.parameters.json create mode 100644 modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep delete mode 100644 modules/Microsoft.Authorization/policyExemptions/.test/rg.min.parameters.json create mode 100644 modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep delete mode 100644 modules/Microsoft.Authorization/policyExemptions/.test/rg.parameters.json create mode 100644 modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep delete mode 100644 modules/Microsoft.Authorization/policyExemptions/.test/sub.min.parameters.json create mode 100644 modules/Microsoft.Authorization/policyExemptions/.test/sub.min/deploy.test.bicep delete mode 100644 modules/Microsoft.Authorization/policyExemptions/.test/sub.parameters.json create mode 100644 modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep diff --git a/.github/workflows/ms.authorization.policyexemptions.yml b/.github/workflows/ms.authorization.policyexemptions.yml index 878f3665c1..f880d599a4 100644 --- a/.github/workflows/ms.authorization.policyexemptions.yml +++ b/.github/workflows/ms.authorization.policyexemptions.yml @@ -109,8 +109,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.Authorization/policyExemptions/.test/mg.min.parameters.json b/modules/Microsoft.Authorization/policyExemptions/.test/mg.min.parameters.json deleted file mode 100644 index f5816fcd6d..0000000000 --- a/modules/Microsoft.Authorization/policyExemptions/.test/mg.min.parameters.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-min-mg-polexem" - }, - "policyAssignmentId": { - "value": "/providers/Microsoft.Management/managementGroups/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-mg-pass-loc-rg" - } - } -} diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/mg.min/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/mg.min/deploy.test.bicep new file mode 100644 index 0000000000..6e28b25ab3 --- /dev/null +++ b/modules/Microsoft.Authorization/policyExemptions/.test/mg.min/deploy.test.bicep @@ -0,0 +1,37 @@ +targetScope = 'managementGroup' + +// ========== // +// Parameters // +// ========== // +@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 = 'apemgmin' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource policyAssignment 'Microsoft.Authorization/policyAssignments@2021-06-01' = { + name: 'dep-<>-${serviceShort}-rgloc' + location: location + properties: { + displayName: '[Depedency] Audit resource location matches resource group location (management group scope)' + policyDefinitionId: '/providers/Microsoft.Authorization/policyDefinitions/0a914e76-4921-4c19-b460-a2d36003525a' + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../managementGroup/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + policyAssignmentId: policyAssignment.id + } +} diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/mg.parameters.json b/modules/Microsoft.Authorization/policyExemptions/.test/mg.parameters.json deleted file mode 100644 index 2c76ecb64a..0000000000 --- a/modules/Microsoft.Authorization/policyExemptions/.test/mg.parameters.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-mg-polexem" - }, - "displayName": { - "value": "[Display Name] policy exempt (management group scope)" - }, - "policyAssignmentId": { - "value": "/providers/Microsoft.Management/managementGroups/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-mg-pass-loc-rg" - }, - "exemptionCategory": { - "value": "Waiver" - }, - "metadata": { - "value": { - "category": "Security" - } - }, - "expiresOn": { - "value": "2025-10-02T03:57:00.000Z" - }, - "managementGroupId": { - "value": "<>" - } - } -} diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep new file mode 100644 index 0000000000..9ac695d9ba --- /dev/null +++ b/modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep @@ -0,0 +1,45 @@ +targetScope = 'managementGroup' + +// ========== // +// Parameters // +// ========== // +@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 = 'apemg' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= + +resource policyAssignment 'Microsoft.Authorization/policyAssignments@2021-06-01' = { + name: 'dep-<>-${serviceShort}-rgloc' + location: location + properties: { + displayName: '[Depedency] Audit resource location matches resource group location (management group scope)' + policyDefinitionId: '/providers/Microsoft.Authorization/policyDefinitions/0a914e76-4921-4c19-b460-a2d36003525a' + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../managementGroup/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + policyAssignmentId: policyAssignment.id + displayName: '[Display Name] policy exempt (management group scope)' + exemptionCategory: 'Waiver' + expiresOn: '2025-10-02T03:57:00Z' + managementGroupId: last(split(managementGroup().id, '/')) + metadata: { + category: 'Security' + } + } +} diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/rg.min.parameters.json b/modules/Microsoft.Authorization/policyExemptions/.test/rg.min.parameters.json deleted file mode 100644 index 2573b17fe7..0000000000 --- a/modules/Microsoft.Authorization/policyExemptions/.test/rg.min.parameters.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-min-rg-polexem" - }, - "policyAssignmentId": { - "value": "/subscriptions/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-sb-pass-loc-rg" - }, - "subscriptionId": { - "value": "<>" - }, - "resourceGroupName": { - "value": "<>" - } - } -} diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep new file mode 100644 index 0000000000..f988f5d9a2 --- /dev/null +++ b/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep @@ -0,0 +1,49 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for a testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.authorization.policyexemptions-${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 = 'apergmin' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: resourceGroupName + location: location +} + +resource policyAssignment 'Microsoft.Authorization/policyAssignments@2021-06-01' = { + name: 'dep-<>-${serviceShort}-rgloc' + location: location + properties: { + displayName: '[Depedency] Audit resource location matches resource group location (management group scope)' + policyDefinitionId: '/providers/Microsoft.Authorization/policyDefinitions/0a914e76-4921-4c19-b460-a2d36003525a' + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../resourceGroup/deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + policyAssignmentId: policyAssignment.id + resourceGroupName: resourceGroup.name + subscriptionId: subscription().subscriptionId + } +} diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/rg.parameters.json b/modules/Microsoft.Authorization/policyExemptions/.test/rg.parameters.json deleted file mode 100644 index 68fda77deb..0000000000 --- a/modules/Microsoft.Authorization/policyExemptions/.test/rg.parameters.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-rg-polexem" - }, - "displayName": { - "value": "[Display Name] policy exempt (resource group scope)" - }, - "policyAssignmentId": { - "value": "/subscriptions/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-sb-pass-loc-rg" - }, - "exemptionCategory": { - "value": "Waiver" - }, - "metadata": { - "value": { - "category": "Security" - } - }, - "expiresOn": { - "value": "2025-10-02T03:57:00.000Z" - }, - "subscriptionId": { - "value": "<>" - }, - "resourceGroupName": { - "value": "<>" - } - } -} diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep new file mode 100644 index 0000000000..c36267a63c --- /dev/null +++ b/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep @@ -0,0 +1,55 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for a testing purposes') +@maxLength(90) +param resourceGroupName string = 'ms.authorization.policyexemptions-${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 = 'aperg' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { + name: resourceGroupName + location: location +} + +resource policyAssignment 'Microsoft.Authorization/policyAssignments@2021-06-01' = { + name: 'dep-<>-${serviceShort}-rgloc' + location: location + properties: { + displayName: '[Depedency] Audit resource location matches resource group location (management group scope)' + policyDefinitionId: '/providers/Microsoft.Authorization/policyDefinitions/0a914e76-4921-4c19-b460-a2d36003525a' + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../resourceGroup/deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + policyAssignmentId: policyAssignment.id + displayName: '[Display Name] policy exempt (resource group scope)' + exemptionCategory: 'Waiver' + expiresOn: '2025-10-02T03:57:00Z' + metadata: { + category: 'Security' + } + resourceGroupName: resourceGroup.name + subscriptionId: subscription().subscriptionId + } +} diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/sub.min.parameters.json b/modules/Microsoft.Authorization/policyExemptions/.test/sub.min.parameters.json deleted file mode 100644 index 920e7d2add..0000000000 --- a/modules/Microsoft.Authorization/policyExemptions/.test/sub.min.parameters.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-min-sub-polexem" - }, - "policyAssignmentId": { - "value": "/subscriptions/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-sb-pass-loc-rg" - }, - "subscriptionId": { - "value": "<>" - } - } -} diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/sub.min/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/sub.min/deploy.test.bicep new file mode 100644 index 0000000000..b305dec286 --- /dev/null +++ b/modules/Microsoft.Authorization/policyExemptions/.test/sub.min/deploy.test.bicep @@ -0,0 +1,38 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@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 = 'apesubmin' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource policyAssignment 'Microsoft.Authorization/policyAssignments@2021-06-01' = { + name: 'dep-<>-${serviceShort}-rgloc' + location: location + properties: { + displayName: '[Depedency] Audit resource location matches resource group location (management group scope)' + policyDefinitionId: '/providers/Microsoft.Authorization/policyDefinitions/0a914e76-4921-4c19-b460-a2d36003525a' + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../subscription/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + policyAssignmentId: policyAssignment.id + subscriptionId: subscription().subscriptionId + } +} diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/sub.parameters.json b/modules/Microsoft.Authorization/policyExemptions/.test/sub.parameters.json deleted file mode 100644 index 02b3e9037c..0000000000 --- a/modules/Microsoft.Authorization/policyExemptions/.test/sub.parameters.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-sub-polexem" - }, - "displayName": { - "value": "[Display Name] policy exempt (subscription scope)" - }, - "policyAssignmentId": { - "value": "/subscriptions/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-sb-pass-loc-rg" - }, - "exemptionCategory": { - "value": "Waiver" - }, - "metadata": { - "value": { - "category": "Security" - } - }, - "expiresOn": { - "value": "2025-10-02T03:57:00.000Z" - }, - "subscriptionId": { - "value": "<>" - } - } -} diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep new file mode 100644 index 0000000000..ebdce8847a --- /dev/null +++ b/modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep @@ -0,0 +1,44 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@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 = 'apesub' + +// =========== // +// Deployments // +// =========== // + +// General resources +// ================= +resource policyAssignment 'Microsoft.Authorization/policyAssignments@2021-06-01' = { + name: 'dep-<>-${serviceShort}-rgloc' + location: location + properties: { + displayName: '[Depedency] Audit resource location matches resource group location (management group scope)' + policyDefinitionId: '/providers/Microsoft.Authorization/policyDefinitions/0a914e76-4921-4c19-b460-a2d36003525a' + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../subscription/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + policyAssignmentId: policyAssignment.id + displayName: '[Display Name] policy exempt (subscription scope)' + exemptionCategory: 'Waiver' + expiresOn: '2025-10-02T03:57:00Z' + metadata: { + category: 'Security' + } + subscriptionId: subscription().subscriptionId + } +} diff --git a/modules/Microsoft.Authorization/policyExemptions/readme.md b/modules/Microsoft.Authorization/policyExemptions/readme.md index 4e487c3b93..0c4724d11c 100644 --- a/modules/Microsoft.Authorization/policyExemptions/readme.md +++ b/modules/Microsoft.Authorization/policyExemptions/readme.md @@ -158,67 +158,24 @@ The following module usage examples are retrieved from the content of the files >**Note**: The name of each example is based on the name of the file from which it is taken. >**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order. -

Example 1: Mg Min

+

Example 1: Mg

via Bicep module ```bicep -module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-policyExemptions' +module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-apemg' params: { // Required parameters - name: '<>-min-mg-polexem' - policyAssignmentId: '/providers/Microsoft.Management/managementGroups/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-mg-pass-loc-rg' - } -} -``` - -
-

- -

- -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": "<>-min-mg-polexem" - }, - "policyAssignmentId": { - "value": "/providers/Microsoft.Management/managementGroups/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-mg-pass-loc-rg" - } - } -} -``` - -
-

- -

Example 2: Mg

- -
- -via Bicep module - -```bicep -module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-policyExemptions' - params: { - // Required parameters - name: '<>-mg-polexem' - policyAssignmentId: '/providers/Microsoft.Management/managementGroups/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-mg-pass-loc-rg' + name: '<>apemg001' + policyAssignmentId: '' // Non-required parameters displayName: '[Display Name] policy exempt (management group scope)' exemptionCategory: 'Waiver' expiresOn: '2025-10-02T03:57:00Z' - managementGroupId: '<>' + managementGroupId: '' metadata: { category: 'Security' } @@ -240,10 +197,10 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep "parameters": { // Required parameters "name": { - "value": "<>-mg-polexem" + "value": "<>apemg001" }, "policyAssignmentId": { - "value": "/providers/Microsoft.Management/managementGroups/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-mg-pass-loc-rg" + "value": "" }, // Non-required parameters "displayName": { @@ -256,7 +213,7 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep "value": "2025-10-02T03:57:00Z" }, "managementGroupId": { - "value": "<>" + "value": "" }, "metadata": { "value": { @@ -270,22 +227,19 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep

-

Example 3: Rg Min

+

Example 2: Mg.Min

via Bicep module ```bicep -module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-policyExemptions' +module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-apemgmin' params: { // Required parameters - name: '<>-min-rg-polexem' - policyAssignmentId: '/subscriptions/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-sb-pass-loc-rg' - // Non-required parameters - resourceGroupName: '<>' - subscriptionId: '<>' + name: '<>apemgmin001' + policyAssignmentId: '' } } ``` @@ -304,17 +258,10 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep "parameters": { // Required parameters "name": { - "value": "<>-min-rg-polexem" + "value": "<>apemgmin001" }, "policyAssignmentId": { - "value": "/subscriptions/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-sb-pass-loc-rg" - }, - // Non-required parameters - "resourceGroupName": { - "value": "<>" - }, - "subscriptionId": { - "value": "<>" + "value": "" } } } @@ -323,19 +270,19 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep

-

Example 4: Rg

+

Example 3: Rg

via Bicep module ```bicep -module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-policyExemptions' +module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-aperg' params: { // Required parameters - name: '<>-rg-polexem' - policyAssignmentId: '/subscriptions/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-sb-pass-loc-rg' + name: '<>aperg001' + policyAssignmentId: '' // Non-required parameters displayName: '[Display Name] policy exempt (resource group scope)' exemptionCategory: 'Waiver' @@ -343,8 +290,8 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep metadata: { category: 'Security' } - resourceGroupName: '<>' - subscriptionId: '<>' + resourceGroupName: '' + subscriptionId: '' } } ``` @@ -363,10 +310,10 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep "parameters": { // Required parameters "name": { - "value": "<>-rg-polexem" + "value": "<>aperg001" }, "policyAssignmentId": { - "value": "/subscriptions/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-sb-pass-loc-rg" + "value": "" }, // Non-required parameters "displayName": { @@ -384,10 +331,10 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep } }, "resourceGroupName": { - "value": "<>" + "value": "" }, "subscriptionId": { - "value": "<>" + "value": "" } } } @@ -396,21 +343,22 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep

-

Example 5: Sub Min

+

Example 4: Rg.Min

via Bicep module ```bicep -module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-policyExemptions' +module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-apergmin' params: { // Required parameters - name: '<>-min-sub-polexem' - policyAssignmentId: '/subscriptions/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-sb-pass-loc-rg' + name: '<>apergmin001' + policyAssignmentId: '' // Non-required parameters - subscriptionId: '<>' + resourceGroupName: '' + subscriptionId: '' } } ``` @@ -429,14 +377,17 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep "parameters": { // Required parameters "name": { - "value": "<>-min-sub-polexem" + "value": "<>apergmin001" }, "policyAssignmentId": { - "value": "/subscriptions/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-sb-pass-loc-rg" + "value": "" }, // Non-required parameters + "resourceGroupName": { + "value": "" + }, "subscriptionId": { - "value": "<>" + "value": "" } } } @@ -445,19 +396,19 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep

-

Example 6: Sub

+

Example 5: Sub

via Bicep module ```bicep -module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-policyExemptions' +module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-apesub' params: { // Required parameters - name: '<>-sub-polexem' - policyAssignmentId: '/subscriptions/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-sb-pass-loc-rg' + name: '<>apesub001' + policyAssignmentId: '' // Non-required parameters displayName: '[Display Name] policy exempt (subscription scope)' exemptionCategory: 'Waiver' @@ -465,7 +416,7 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep metadata: { category: 'Security' } - subscriptionId: '<>' + subscriptionId: '' } } ``` @@ -484,10 +435,10 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep "parameters": { // Required parameters "name": { - "value": "<>-sub-polexem" + "value": "<>apesub001" }, "policyAssignmentId": { - "value": "/subscriptions/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-sb-pass-loc-rg" + "value": "" }, // Non-required parameters "displayName": { @@ -505,7 +456,56 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep } }, "subscriptionId": { - "value": "<>" + "value": "" + } + } +} +``` + +
+

+ +

Example 6: Sub.Min

+ +
+ +via Bicep module + +```bicep +module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-apesubmin' + params: { + // Required parameters + name: '<>apesubmin001' + policyAssignmentId: '' + // Non-required parameters + subscriptionId: '' + } +} +``` + +
+

+ +

+ +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": "<>apesubmin001" + }, + "policyAssignmentId": { + "value": "" + }, + // Non-required parameters + "subscriptionId": { + "value": "" } } } diff --git a/utilities/tools/Set-ModuleReadMe.ps1 b/utilities/tools/Set-ModuleReadMe.ps1 index a1074fed21..6b922d65e8 100644 --- a/utilities/tools/Set-ModuleReadMe.ps1 +++ b/utilities/tools/Set-ModuleReadMe.ps1 @@ -883,9 +883,10 @@ function Set-DeploymentExamplesSection { '' ) + $TextInfo = (Get-Culture -Name 'en-US').TextInfo $moduleRoot = Split-Path $TemplateFilePath -Parent - $resourceTypeIdentifier = $moduleRoot.Replace('\', '/').Split('/modules/')[1].TrimStart('/') - $resourceType = $resourceTypeIdentifier.Split('/')[1] + $resourceTypeIdentifier = $TextInfo.ToTitleCase($moduleRoot.Replace('\', '/').Split('/modules/')[1].TrimStart('/')) + $resourceType = $TextInfo.ToTitleCase($resourceTypeIdentifier.Split('/')[1]) $testFilePaths = Get-ModuleTestFileList -ModulePath $moduleRoot | ForEach-Object { Join-Path $moduleRoot $_ } $RequiredParametersList = $TemplateFileContent.parameters.Keys | Where-Object { $TemplateFileContent.parameters[$_].Keys -notcontains 'defaultValue' } | Sort-Object @@ -906,7 +907,6 @@ function Set-DeploymentExamplesSection { } else { $exampleTitle = ((Split-Path $testFilePath -LeafBase) -replace '\.', ' ') -replace ' parameters', '' } - $TextInfo = (Get-Culture -Name 'en-US').TextInfo $exampleTitle = $TextInfo.ToTitleCase($exampleTitle) $SectionContent += @( '

Example {0}: {1}

' -f $pathIndex, $exampleTitle From a5d4c01cc6119aa03a5d0019d534378fae73abf8 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Thu, 1 Sep 2022 10:14:06 +0200 Subject: [PATCH 2/8] Update to latest --- .../policyExemptions/readme.md | 12 +++++----- utilities/tools/Set-ModuleReadMe.ps1 | 23 ++++++++++++------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/modules/Microsoft.Authorization/policyExemptions/readme.md b/modules/Microsoft.Authorization/policyExemptions/readme.md index 0c4724d11c..b086f8fdcf 100644 --- a/modules/Microsoft.Authorization/policyExemptions/readme.md +++ b/modules/Microsoft.Authorization/policyExemptions/readme.md @@ -165,7 +165,7 @@ The following module usage examples are retrieved from the content of the files via Bicep module ```bicep -module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep' = { +module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { name: '${uniqueString(deployment().name)}-test-apemg' params: { // Required parameters @@ -234,7 +234,7 @@ module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep via Bicep module ```bicep -module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep' = { +module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { name: '${uniqueString(deployment().name)}-test-apemgmin' params: { // Required parameters @@ -277,7 +277,7 @@ module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep via Bicep module ```bicep -module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep' = { +module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { name: '${uniqueString(deployment().name)}-test-aperg' params: { // Required parameters @@ -350,7 +350,7 @@ module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep via Bicep module ```bicep -module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep' = { +module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { name: '${uniqueString(deployment().name)}-test-apergmin' params: { // Required parameters @@ -403,7 +403,7 @@ module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep via Bicep module ```bicep -module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep' = { +module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { name: '${uniqueString(deployment().name)}-test-apesub' params: { // Required parameters @@ -472,7 +472,7 @@ module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep via Bicep module ```bicep -module Policyexemptions './Microsoft.Authorization/Policyexemptions/deploy.bicep' = { +module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { name: '${uniqueString(deployment().name)}-test-apesubmin' params: { // Required parameters diff --git a/utilities/tools/Set-ModuleReadMe.ps1 b/utilities/tools/Set-ModuleReadMe.ps1 index 6b922d65e8..25d22f3fff 100644 --- a/utilities/tools/Set-ModuleReadMe.ps1 +++ b/utilities/tools/Set-ModuleReadMe.ps1 @@ -51,7 +51,7 @@ function Set-ResourceTypesSection { $RelevantResourceTypeObjects = Get-NestedResourceList $TemplateFileContent | Where-Object { $_.type -notin $ResourceTypesToExclude -and $_ - } | Select-Object 'Type', 'ApiVersion' -Unique | Sort-Object Type -Culture en-US + } | Select-Object 'Type', 'ApiVersion' -Unique | Sort-Object Type -Culture 'en-US' foreach ($resourceTypeObject in $RelevantResourceTypeObjects) { $ProviderNamespace, $ResourceType = $resourceTypeObject.Type -split '/', 2 @@ -280,7 +280,7 @@ function Set-OutputsSection { '| Output Name | Type | Description |', '| :-- | :-- | :-- |' ) - foreach ($outputName in ($templateFileContent.outputs.Keys | Sort-Object -Culture en-US)) { + foreach ($outputName in ($templateFileContent.outputs.Keys | Sort-Object -Culture 'en-US')) { $output = $TemplateFileContent.outputs[$outputName] $description = $output.metadata.description.Replace("`r`n", '

').Replace("`n", '

') $SectionContent += ("| ``{0}`` | {1} | {2} |" -f $outputName, $output.type, $description) @@ -290,7 +290,7 @@ function Set-OutputsSection { '| Output Name | Type |', '| :-- | :-- |' ) - foreach ($outputName in ($templateFileContent.outputs.Keys | Sort-Object -Culture en-US)) { + foreach ($outputName in ($templateFileContent.outputs.Keys | Sort-Object -Culture 'en-US')) { $output = $TemplateFileContent.outputs[$outputName] $SectionContent += ("| ``{0}`` | {1} |" -f $outputName, $output.type) } @@ -883,10 +883,16 @@ function Set-DeploymentExamplesSection { '' ) - $TextInfo = (Get-Culture -Name 'en-US').TextInfo $moduleRoot = Split-Path $TemplateFilePath -Parent - $resourceTypeIdentifier = $TextInfo.ToTitleCase($moduleRoot.Replace('\', '/').Split('/modules/')[1].TrimStart('/')) - $resourceType = $TextInfo.ToTitleCase($resourceTypeIdentifier.Split('/')[1]) + $fullIdentifier = $moduleRoot.Replace('\', '/').Split('/modules/')[1].TrimStart('/') + + # Get resource type and make first letter upper case. Requires manual handling as ToTitleCase lowercases everything but the first letter + $providerNamespace = ($fullIdentifier.Split('/')[0] -split '\.' | ForEach-Object { $_.Substring(0, 1).ToUpper() + $_.Substring(1) }) -join '.' + $resourceType = $fullIdentifier.Split('/')[1] + $resourceTypeUpper = $resourceType.Substring(0, 1).ToUpper() + $resourceType.Substring(1) + + $resourceTypeIdentifier = "$providerNamespace/$resourceType" + $testFilePaths = Get-ModuleTestFileList -ModulePath $moduleRoot | ForEach-Object { Join-Path $moduleRoot $_ } $RequiredParametersList = $TemplateFileContent.parameters.Keys | Where-Object { $TemplateFileContent.parameters[$_].Keys -notcontains 'defaultValue' } | Sort-Object @@ -907,7 +913,8 @@ function Set-DeploymentExamplesSection { } else { $exampleTitle = ((Split-Path $testFilePath -LeafBase) -replace '\.', ' ') -replace ' parameters', '' } - $exampleTitle = $TextInfo.ToTitleCase($exampleTitle) + $textInfo = (Get-Culture -Name 'en-US').TextInfo + $exampleTitle = $textInfo.ToTitleCase($exampleTitle) $SectionContent += @( '

Example {0}: {1}

' -f $pathIndex, $exampleTitle ) @@ -1138,7 +1145,7 @@ function Set-DeploymentExamplesSection { '```bicep', $extendedKeyVaultReferences, "module $resourceType './$resourceTypeIdentifier/deploy.bicep' = {" - " name: '`${uniqueString(deployment().name)}-$resourceType'" + " name: '`${uniqueString(deployment().name)}-$resourceTypeUpper'" ' params: {' $bicepExample.TrimEnd(), ' }' From b36c6ede5e1ebda5d4f34eecbe52f1b3ab5f2e7d Mon Sep 17 00:00:00 2001 From: MrMCake Date: Thu, 1 Sep 2022 11:30:40 +0200 Subject: [PATCH 3/8] Update to latest --- .../policyExemptions/readme.md | 67 ++++--------------- 1 file changed, 12 insertions(+), 55 deletions(-) diff --git a/modules/Microsoft.Authorization/policyExemptions/readme.md b/modules/Microsoft.Authorization/policyExemptions/readme.md index 1c391d94f7..b086f8fdcf 100644 --- a/modules/Microsoft.Authorization/policyExemptions/readme.md +++ b/modules/Microsoft.Authorization/policyExemptions/readme.md @@ -165,55 +165,12 @@ The following module usage examples are retrieved from the content of the files via Bicep module ```bicep -module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-PolicyExemptions' - params: { - // Required parameters - name: '<>-min-mg-polexem' - policyAssignmentId: '/providers/Microsoft.Management/managementGroups/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-mg-pass-loc-rg' - } -} -``` - -
-

- -

- -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": "<>-min-mg-polexem" - }, - "policyAssignmentId": { - "value": "/providers/Microsoft.Management/managementGroups/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-mg-pass-loc-rg" - } - } -} -``` - -
-

- -

Example 2: Mg

- -
- -via Bicep module - -```bicep -module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-PolicyExemptions' +module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-apemg' params: { // Required parameters - name: '<>-mg-polexem' - policyAssignmentId: '/providers/Microsoft.Management/managementGroups/<>/providers/Microsoft.Authorization/policyAssignments/adp-<>-mg-pass-loc-rg' + name: '<>apemg001' + policyAssignmentId: '' // Non-required parameters displayName: '[Display Name] policy exempt (management group scope)' exemptionCategory: 'Waiver' @@ -277,8 +234,8 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep via Bicep module ```bicep -module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-PolicyExemptions' +module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-apemgmin' params: { // Required parameters name: '<>apemgmin001' @@ -320,8 +277,8 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep via Bicep module ```bicep -module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-PolicyExemptions' +module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-aperg' params: { // Required parameters name: '<>aperg001' @@ -393,8 +350,8 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep via Bicep module ```bicep -module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-PolicyExemptions' +module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-apergmin' params: { // Required parameters name: '<>apergmin001' @@ -446,8 +403,8 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep via Bicep module ```bicep -module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-PolicyExemptions' +module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { + name: '${uniqueString(deployment().name)}-test-apesub' params: { // Required parameters name: '<>apesub001' From 412b0ce8e9cdbadceee8032c79c9efc5c7d13463 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Thu, 8 Sep 2022 18:48:15 +0200 Subject: [PATCH 4/8] Updated folder default to common. --- .../policyExemptions/readme.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/Microsoft.Authorization/policyExemptions/readme.md b/modules/Microsoft.Authorization/policyExemptions/readme.md index b086f8fdcf..00002a60c9 100644 --- a/modules/Microsoft.Authorization/policyExemptions/readme.md +++ b/modules/Microsoft.Authorization/policyExemptions/readme.md @@ -165,7 +165,7 @@ The following module usage examples are retrieved from the content of the files via Bicep module ```bicep -module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { +module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { name: '${uniqueString(deployment().name)}-test-apemg' params: { // Required parameters @@ -234,7 +234,7 @@ module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep via Bicep module ```bicep -module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { +module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { name: '${uniqueString(deployment().name)}-test-apemgmin' params: { // Required parameters @@ -277,7 +277,7 @@ module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep via Bicep module ```bicep -module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { +module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { name: '${uniqueString(deployment().name)}-test-aperg' params: { // Required parameters @@ -350,7 +350,7 @@ module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep via Bicep module ```bicep -module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { +module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { name: '${uniqueString(deployment().name)}-test-apergmin' params: { // Required parameters @@ -403,7 +403,7 @@ module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep via Bicep module ```bicep -module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { +module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { name: '${uniqueString(deployment().name)}-test-apesub' params: { // Required parameters @@ -472,7 +472,7 @@ module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep via Bicep module ```bicep -module PolicyExemptions './Microsoft.Authorization/PolicyExemptions/deploy.bicep' = { +module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { name: '${uniqueString(deployment().name)}-test-apesubmin' params: { // Required parameters From 6c565a360fb53eebb8d0ad668a497a751194ad32 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 9 Sep 2022 12:49:17 +0200 Subject: [PATCH 5/8] Update to latest --- .../policyExemptions/.test/mg.min/deploy.test.bicep | 2 +- .../policyExemptions/.test/mg/deploy.test.bicep | 2 +- .../policyExemptions/.test/rg.min/deploy.test.bicep | 2 +- .../policyExemptions/.test/rg/deploy.test.bicep | 2 +- .../policyExemptions/.test/sub.min/deploy.test.bicep | 2 +- .../policyExemptions/.test/sub/deploy.test.bicep | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/mg.min/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/mg.min/deploy.test.bicep index 6e28b25ab3..f1ae763616 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/mg.min/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/mg.min/deploy.test.bicep @@ -6,7 +6,7 @@ targetScope = 'managementGroup' @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 = 'apemgmin' // =========== // diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep index 9ac695d9ba..d94923b575 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep @@ -6,7 +6,7 @@ targetScope = 'managementGroup' @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 = 'apemg' // =========== // diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep index f988f5d9a2..8273c9e4e3 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep @@ -10,7 +10,7 @@ param resourceGroupName string = 'ms.authorization.policyexemptions-${serviceSho @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 = 'apergmin' // =========== // diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep index c36267a63c..849231b424 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep @@ -10,7 +10,7 @@ param resourceGroupName string = 'ms.authorization.policyexemptions-${serviceSho @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 = 'aperg' // =========== // diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/sub.min/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/sub.min/deploy.test.bicep index b305dec286..67a65fe11a 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/sub.min/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/sub.min/deploy.test.bicep @@ -6,7 +6,7 @@ targetScope = 'subscription' @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 = 'apesubmin' // =========== // diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep index ebdce8847a..6916af8c25 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep @@ -6,7 +6,7 @@ targetScope = 'subscription' @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 = 'apesub' // =========== // From 2093a69426e177fe70255ecbb86db2180c52d1e0 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Fri, 9 Sep 2022 13:02:10 +0200 Subject: [PATCH 6/8] Update to latest --- .../policyExemptions/.test/mg.min/deploy.test.bicep | 4 ++-- .../policyExemptions/.test/mg/deploy.test.bicep | 4 ++-- .../policyExemptions/.test/rg.min/deploy.test.bicep | 6 +++--- .../policyExemptions/.test/rg/deploy.test.bicep | 6 +++--- .../policyExemptions/.test/sub.min/deploy.test.bicep | 4 ++-- .../policyExemptions/.test/sub/deploy.test.bicep | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/mg.min/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/mg.min/deploy.test.bicep index f1ae763616..af4e001bbf 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/mg.min/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/mg.min/deploy.test.bicep @@ -3,10 +3,10 @@ targetScope = 'managementGroup' // ========== // // Parameters // // ========== // -@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') +@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 = 'apemgmin' // =========== // diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep index d94923b575..3c09ed8803 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep @@ -3,10 +3,10 @@ targetScope = 'managementGroup' // ========== // // Parameters // // ========== // -@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') +@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 = 'apemg' // =========== // diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep index 8273c9e4e3..d711a303b6 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep @@ -3,14 +3,14 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@description('Optional. The name of the resource group to deploy for a testing purposes') +@description('Optional. The name of the resource group to deploy for a testing purposes.') @maxLength(90) param resourceGroupName string = 'ms.authorization.policyexemptions-${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') +@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 = 'apergmin' // =========== // diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep index 849231b424..b6180124cf 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep @@ -3,14 +3,14 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@description('Optional. The name of the resource group to deploy for a testing purposes') +@description('Optional. The name of the resource group to deploy for a testing purposes.') @maxLength(90) param resourceGroupName string = 'ms.authorization.policyexemptions-${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') +@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 = 'aperg' // =========== // diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/sub.min/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/sub.min/deploy.test.bicep index 67a65fe11a..4c3bf31db0 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/sub.min/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/sub.min/deploy.test.bicep @@ -3,10 +3,10 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@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') +@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 = 'apesubmin' // =========== // diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep index 6916af8c25..4ecca938fa 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep @@ -3,10 +3,10 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@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') +@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 = 'apesub' // =========== // From 8b6ca4f5f2ed96f94cadc6a2290e7621e70e05c4 Mon Sep 17 00:00:00 2001 From: MrMCake Date: Sun, 18 Sep 2022 23:06:20 +0200 Subject: [PATCH 7/8] Update to latest --- .../policyExemptions/.test/rg.min/deploy.test.bicep | 2 +- .../policyExemptions/.test/rg/deploy.test.bicep | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep index d711a303b6..8c3a632989 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/rg.min/deploy.test.bicep @@ -3,7 +3,7 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@description('Optional. The name of the resource group to deploy for a testing purposes.') +@description('Optional. The name of the resource group to deploy for testing purposes.') @maxLength(90) param resourceGroupName string = 'ms.authorization.policyexemptions-${serviceShort}-rg' diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep index b6180124cf..afc63348ab 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep @@ -3,7 +3,7 @@ targetScope = 'subscription' // ========== // // Parameters // // ========== // -@description('Optional. The name of the resource group to deploy for a testing purposes.') +@description('Optional. The name of the resource group to deploy for testing purposes.') @maxLength(90) param resourceGroupName string = 'ms.authorization.policyexemptions-${serviceShort}-rg' From c6135796fa23c685220b558d5ef5820c823d8c4f Mon Sep 17 00:00:00 2001 From: MrMCake Date: Mon, 24 Oct 2022 09:26:01 +0200 Subject: [PATCH 8/8] Updated folder names & name Prefix --- .../.test/{mg => mg.common}/deploy.test.bicep | 2 +- .../.test/{rg => rg.common}/deploy.test.bicep | 2 +- .../{sub => sub.common}/deploy.test.bicep | 2 +- .../policyExemptions/readme.md | 24 +++++++++---------- 4 files changed, 15 insertions(+), 15 deletions(-) rename modules/Microsoft.Authorization/policyExemptions/.test/{mg => mg.common}/deploy.test.bicep (97%) rename modules/Microsoft.Authorization/policyExemptions/.test/{rg => rg.common}/deploy.test.bicep (97%) rename modules/Microsoft.Authorization/policyExemptions/.test/{sub => sub.common}/deploy.test.bicep (97%) diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/mg.common/deploy.test.bicep similarity index 97% rename from modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep rename to modules/Microsoft.Authorization/policyExemptions/.test/mg.common/deploy.test.bicep index 3c09ed8803..621d2bc94f 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/mg/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/mg.common/deploy.test.bicep @@ -7,7 +7,7 @@ targetScope = 'managementGroup' 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 = 'apemg' +param serviceShort string = 'apemgcom' // =========== // // Deployments // diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/rg.common/deploy.test.bicep similarity index 97% rename from modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep rename to modules/Microsoft.Authorization/policyExemptions/.test/rg.common/deploy.test.bicep index afc63348ab..26f0acbfb8 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/rg/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/rg.common/deploy.test.bicep @@ -11,7 +11,7 @@ param resourceGroupName string = 'ms.authorization.policyexemptions-${serviceSho 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 = 'aperg' +param serviceShort string = 'apergcom' // =========== // // Deployments // diff --git a/modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep b/modules/Microsoft.Authorization/policyExemptions/.test/sub.common/deploy.test.bicep similarity index 97% rename from modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep rename to modules/Microsoft.Authorization/policyExemptions/.test/sub.common/deploy.test.bicep index 4ecca938fa..8b671c72a8 100644 --- a/modules/Microsoft.Authorization/policyExemptions/.test/sub/deploy.test.bicep +++ b/modules/Microsoft.Authorization/policyExemptions/.test/sub.common/deploy.test.bicep @@ -7,7 +7,7 @@ targetScope = 'subscription' 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 = 'apesub' +param serviceShort string = 'apesubcom' // =========== // // Deployments // diff --git a/modules/Microsoft.Authorization/policyExemptions/readme.md b/modules/Microsoft.Authorization/policyExemptions/readme.md index 8d61370305..e833ed6e37 100644 --- a/modules/Microsoft.Authorization/policyExemptions/readme.md +++ b/modules/Microsoft.Authorization/policyExemptions/readme.md @@ -159,7 +159,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: Mg

+

Example 1: Mg.Common

@@ -167,10 +167,10 @@ The following module usage examples are retrieved from the content of the files ```bicep module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-test-apemg' + name: '${uniqueString(deployment().name)}-test-apemgcom' params: { // Required parameters - name: '<>apemg001' + name: '<>apemgcom001' policyAssignmentId: '' // Non-required parameters displayName: '[Display Name] policy exempt (management group scope)' @@ -198,7 +198,7 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep "parameters": { // Required parameters "name": { - "value": "<>apemg001" + "value": "<>apemgcom001" }, "policyAssignmentId": { "value": "" @@ -271,7 +271,7 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep

-

Example 3: Rg

+

Example 3: Rg.Common

@@ -279,10 +279,10 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep ```bicep module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-test-aperg' + name: '${uniqueString(deployment().name)}-test-apergcom' params: { // Required parameters - name: '<>aperg001' + name: '<>apergcom001' policyAssignmentId: '' // Non-required parameters displayName: '[Display Name] policy exempt (resource group scope)' @@ -311,7 +311,7 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep "parameters": { // Required parameters "name": { - "value": "<>aperg001" + "value": "<>apergcom001" }, "policyAssignmentId": { "value": "" @@ -397,7 +397,7 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep

-

Example 5: Sub

+

Example 5: Sub.Common

@@ -405,10 +405,10 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep ```bicep module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-test-apesub' + name: '${uniqueString(deployment().name)}-test-apesubcom' params: { // Required parameters - name: '<>apesub001' + name: '<>apesubcom001' policyAssignmentId: '' // Non-required parameters displayName: '[Display Name] policy exempt (subscription scope)' @@ -436,7 +436,7 @@ module policyExemptions './Microsoft.Authorization/policyExemptions/deploy.bicep "parameters": { // Required parameters "name": { - "value": "<>apesub001" + "value": "<>apesubcom001" }, "policyAssignmentId": { "value": ""