diff --git a/.github/workflows/ms.logic.workflows.yml b/.github/workflows/ms.logic.workflows.yml index 97c7eac1cd..f6dbecc6a1 100644 --- a/.github/workflows/ms.logic.workflows.yml +++ b/.github/workflows/ms.logic.workflows.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.Logic/workflows/.test/common/dependencies.bicep b/modules/Microsoft.Logic/workflows/.test/common/dependencies.bicep new file mode 100644 index 0000000000..0f0755a6f4 --- /dev/null +++ b/modules/Microsoft.Logic/workflows/.test/common/dependencies.bicep @@ -0,0 +1,16 @@ +@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 + +@description('The resource ID of the created Managed Identity.') +output managedIdentityResourceId string = managedIdentity.id diff --git a/modules/Microsoft.Logic/workflows/.test/common/deploy.test.bicep b/modules/Microsoft.Logic/workflows/.test/common/deploy.test.bicep new file mode 100644 index 0000000000..a028255c33 --- /dev/null +++ b/modules/Microsoft.Logic/workflows/.test/common/deploy.test.bicep @@ -0,0 +1,111 @@ +targetScope = 'subscription' + +// ========== // +// Parameters // +// ========== // +@description('Optional. The name of the resource group to deploy for testing purposes.') +@maxLength(90) +param resourceGroupName string = 'ms.logic.workflows-${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 = 'lwcom' + +// =========== // +// 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}' + } +} + +// Diagnostics +// =========== +module diagnosticDependencies '../../../../.shared/dependencyConstructs/diagnostic.dependencies.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name, location)}-diagnosticDependencies' + params: { + storageAccountName: 'dep<>diasa${serviceShort}01' + logAnalyticsWorkspaceName: 'dep-<>-law-${serviceShort}' + eventHubNamespaceEventHubName: 'dep-<>-evh-${serviceShort}' + eventHubNamespaceName: 'dep-<>-evhns-${serviceShort}' + location: location + } +} + +// ============== // +// Test Execution // +// ============== // + +module testDeployment '../../deploy.bicep' = { + scope: resourceGroup + name: '${uniqueString(deployment().name)}-test-${serviceShort}' + params: { + name: '<>${serviceShort}001' + diagnosticLogsRetentionInDays: 7 + diagnosticStorageAccountId: diagnosticDependencies.outputs.storageAccountResourceId + diagnosticWorkspaceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId + diagnosticEventHubAuthorizationRuleId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId + diagnosticEventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName + lock: 'CanNotDelete' + roleAssignments: [ + { + principalIds: [ + resourceGroupResources.outputs.managedIdentityPrincipalId + ] + roleDefinitionIdOrName: 'Reader' + } + ] + userAssignedIdentities: { + '${resourceGroupResources.outputs.managedIdentityResourceId}': {} + } + tags: { + Environment: 'Non-Prod' + Role: 'DeploymentValidation' + } + workflowActions: { + HTTP: { + inputs: { + body: { + BeginPeakTime: '' + EndPeakTime: '' + HostPoolName: '' + LAWorkspaceName: '' + LimitSecondsToForceLogOffUser: '' + LogOffMessageBody: '' + LogOffMessageTitle: '' + MinimumNumberOfRDSH: 1 + ResourceGroupName: '' + SessionThresholdPerCPU: 1 + UtcOffset: '' + } + method: 'POST' + uri: 'https://testStringForValidation.com' + } + type: 'Http' + } + } + workflowTriggers: { + Recurrence: { + recurrence: { + frequency: 'Minute' + interval: 15 + } + type: 'Recurrence' + } + } + } +} diff --git a/modules/Microsoft.Logic/workflows/.test/parameters.json b/modules/Microsoft.Logic/workflows/.test/parameters.json deleted file mode 100644 index 6436e5c1b7..0000000000 --- a/modules/Microsoft.Logic/workflows/.test/parameters.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "name": { - "value": "<>-az-lga-x-001" - }, - "lock": { - "value": "CanNotDelete" - }, - "tags": { - "value": {} - }, - "workflowActions": { - "value": { - "HTTP": { - "type": "Http", - "inputs": { - "method": "POST", - "uri": "https://testStringForValidation.com", - "body": { - "HostPoolName": "[HostPoolName]", - "LAWorkspaceName": "[LAWorkspaceName]", - "LimitSecondsToForceLogOffUser": "[LimitSecondsToForceLogOffUser]", - "EndPeakTime": "[EndPeakTime]", - "BeginPeakTime": "[BeginPeakTime]", - "UtcOffset": "[UtcOffset]", - "LogOffMessageBody": "[LogOffMessageBody]", - "LogOffMessageTitle": "[LogOffMessageTitle]", - "MinimumNumberOfRDSH": 1, - "SessionThresholdPerCPU": 1, - "ResourceGroupName": "[ResourceGroupName]" - } - } - } - } - }, - "workflowTriggers": { - "value": { - "Recurrence": { - "recurrence": { - "frequency": "Minute", - "interval": 15 - }, - "type": "Recurrence" - } - } - }, - "roleAssignments": { - "value": [ - { - "roleDefinitionIdOrName": "Reader", - "principalIds": [ - "<>" - ] - } - ] - }, - "diagnosticLogsRetentionInDays": { - "value": 7 - }, - "diagnosticStorageAccountId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001" - }, - "diagnosticWorkspaceId": { - "value": "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" - }, - "diagnosticEventHubAuthorizationRuleId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" - }, - "diagnosticEventHubName": { - "value": "adp-<>-az-evh-x-001" - }, - "systemAssignedIdentity": { - "value": true - } - } -} diff --git a/modules/Microsoft.Logic/workflows/readme.md b/modules/Microsoft.Logic/workflows/readme.md index d692197e13..acce2ac0b5 100644 --- a/modules/Microsoft.Logic/workflows/readme.md +++ b/modules/Microsoft.Logic/workflows/readme.md @@ -22,11 +22,13 @@ This module deploys a Logic App resource. ## Parameters **Required parameters** + | Parameter Name | Type | Description | | :-- | :-- | :-- | | `name` | string | The logic app workflow name. | **Optional parameters** + | Parameter Name | Type | Default Value | Allowed Values | Description | | :-- | :-- | :-- | :-- | :-- | | `actionsAccessControlConfiguration` | object | `{object}` | | The access control configuration for workflow actions. | @@ -322,7 +324,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

@@ -330,42 +332,47 @@ The following module usage examples are retrieved from the content of the files ```bicep module workflows './Microsoft.Logic/workflows/deploy.bicep' = { - name: '${uniqueString(deployment().name)}-Workflows' + name: '${uniqueString(deployment().name)}-test-lwcom' params: { // Required parameters - name: '<>-az-lga-x-001' + name: '<>lwcom001' // Non-required parameters - diagnosticEventHubAuthorizationRuleId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey' - diagnosticEventHubName: 'adp-<>-az-evh-x-001' + diagnosticEventHubAuthorizationRuleId: '' + diagnosticEventHubName: '' diagnosticLogsRetentionInDays: 7 - diagnosticStorageAccountId: '/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001' - diagnosticWorkspaceId: '/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001' + diagnosticStorageAccountId: '' + diagnosticWorkspaceId: '' lock: 'CanNotDelete' roleAssignments: [ { principalIds: [ - '<>' + '' ] roleDefinitionIdOrName: 'Reader' } ] - systemAssignedIdentity: true - tags: {} + tags: { + Environment: 'Non-Prod' + Role: 'DeploymentValidation' + } + userAssignedIdentities: { + '': {} + } workflowActions: { HTTP: { inputs: { body: { - BeginPeakTime: '[BeginPeakTime]' - EndPeakTime: '[EndPeakTime]' - HostPoolName: '[HostPoolName]' - LAWorkspaceName: '[LAWorkspaceName]' - LimitSecondsToForceLogOffUser: '[LimitSecondsToForceLogOffUser]' - LogOffMessageBody: '[LogOffMessageBody]' - LogOffMessageTitle: '[LogOffMessageTitle]' + BeginPeakTime: '' + EndPeakTime: '' + HostPoolName: '' + LAWorkspaceName: '' + LimitSecondsToForceLogOffUser: '' + LogOffMessageBody: '' + LogOffMessageTitle: '' MinimumNumberOfRDSH: 1 - ResourceGroupName: '[ResourceGroupName]' + ResourceGroupName: '' SessionThresholdPerCPU: 1 - UtcOffset: '[UtcOffset]' + UtcOffset: '' } method: 'POST' uri: 'https://testStringForValidation.com' @@ -400,23 +407,23 @@ module workflows './Microsoft.Logic/workflows/deploy.bicep' = { "parameters": { // Required parameters "name": { - "value": "<>-az-lga-x-001" + "value": "<>lwcom001" }, // Non-required parameters "diagnosticEventHubAuthorizationRuleId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.EventHub/namespaces/adp-<>-az-evhns-x-001/AuthorizationRules/RootManageSharedAccessKey" + "value": "" }, "diagnosticEventHubName": { - "value": "adp-<>-az-evh-x-001" + "value": "" }, "diagnosticLogsRetentionInDays": { "value": 7 }, "diagnosticStorageAccountId": { - "value": "/subscriptions/<>/resourceGroups/validation-rg/providers/Microsoft.Storage/storageAccounts/adp<>azsax001" + "value": "" }, "diagnosticWorkspaceId": { - "value": "/subscriptions/<>/resourcegroups/validation-rg/providers/microsoft.operationalinsights/workspaces/adp-<>-az-law-x-001" + "value": "" }, "lock": { "value": "CanNotDelete" @@ -425,34 +432,39 @@ module workflows './Microsoft.Logic/workflows/deploy.bicep' = { "value": [ { "principalIds": [ - "<>" + "" ], "roleDefinitionIdOrName": "Reader" } ] }, - "systemAssignedIdentity": { - "value": true - }, "tags": { - "value": {} + "value": { + "Environment": "Non-Prod", + "Role": "DeploymentValidation" + } + }, + "userAssignedIdentities": { + "value": { + "": {} + } }, "workflowActions": { "value": { "HTTP": { "inputs": { "body": { - "BeginPeakTime": "[BeginPeakTime]", - "EndPeakTime": "[EndPeakTime]", - "HostPoolName": "[HostPoolName]", - "LAWorkspaceName": "[LAWorkspaceName]", - "LimitSecondsToForceLogOffUser": "[LimitSecondsToForceLogOffUser]", - "LogOffMessageBody": "[LogOffMessageBody]", - "LogOffMessageTitle": "[LogOffMessageTitle]", + "BeginPeakTime": "", + "EndPeakTime": "", + "HostPoolName": "", + "LAWorkspaceName": "", + "LimitSecondsToForceLogOffUser": "", + "LogOffMessageBody": "", + "LogOffMessageTitle": "", "MinimumNumberOfRDSH": 1, - "ResourceGroupName": "[ResourceGroupName]", + "ResourceGroupName": "", "SessionThresholdPerCPU": 1, - "UtcOffset": "[UtcOffset]" + "UtcOffset": "" }, "method": "POST", "uri": "https://testStringForValidation.com"