diff --git a/pipeline/jobs/create-logicapp-dtu.yaml b/pipeline/jobs/create-logicapp-dtu.yaml index d9fbfff1f..a37497013 100644 --- a/pipeline/jobs/create-logicapp-dtu.yaml +++ b/pipeline/jobs/create-logicapp-dtu.yaml @@ -23,37 +23,26 @@ jobs: displayName: ${{ parameters.displayName }} pool: vmImage: 'windows-latest' - variables: - - template: ../variables/${{ parameters.environment }}.yaml steps: - template: ../steps/replace-token.yaml parameters: path: '**/parameters-*.json' environment: ${{ parameters.environment }} - - template: templates/Azure/Common/get-service-connection-details.yaml@azTemplates - parameters: - subscriptionName: ${{ parameters.subscription }} - - task: replacetokens@3 - displayName: Replace variables in Logic App workflow JSON + - task: AzureCLI@2 + displayName: Create DTU Logic App + name: createLogicApp inputs: - rootDirectory: $(Build.SourcesDirectory) - targetFiles: '**/*-la.json' - encoding: 'auto' - escapeType: 'html' - writeBOM: true - actionOnMissing: 'warn' - keepToken: false - tokenPrefix: '#{' - tokenSuffix: '}#' - useLegacyPattern: false - variableFiles: 'create-logicapp-dtu.yaml' - enableTelemetry: true - - template: ..\steps\create-logic-app.yaml - parameters: - subscription: ${{ parameters.subscription }} - environment: ${{ parameters.environment }} - logicApps: ${{ parameters.logicApps }} - + azureSubscription: ${{ parameters.subscription }} + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + echo "Creating DTU Logic Application for $(environment)" + resourceGroupName="hmi-sharedinfra-$(environment)-rg" + az deployment group create --resource-group $resourceGroupName --template-file "$(System.DefaultWorkingDirectory)\infrastructure\logic-app\rota\hmi-la-rota-dtu-la.json" --parameters "$(System.DefaultWorkingDirectory)\infrastructure\logic-app\rota\parameters-$(environment).json" + echo "Creating DTU Logic Application - Sitting Patterns" + az deployment group create --resource-group $resourceGroupName --template-file "$(System.DefaultWorkingDirectory)\infrastructure\logic-app\sitting-pattern\hmi-la-sittingpatteren-publisher-la.json" --parameters "$(System.DefaultWorkingDirectory)\infrastructure\logic-app\sitting-pattern\sitting-loader-param-$(environment).json" + az deployment group create --resource-group $resourceGroupName --template-file "$(System.DefaultWorkingDirectory)\infrastructure\logic-app\sitting-pattern\hmi-la-sittingpatteren-retriever-la.json" --parameters "$(System.DefaultWorkingDirectory)\infrastructure\logic-app\sitting-pattern\sitting-retriever-param-$(environment).json" + echo "Creating DTU Logic Applications is complete" - task: AzureCLI@2 displayName: Give Logic App Access to Key Vault name: kv_access @@ -63,26 +52,19 @@ jobs: scriptLocation: inlineScript inlineScript: | $env="$(environment)" - $workflowNames=@("hmi-la-dturota-$env", "hmi-la-dturota-file-pub-$env", "hmi-la-listing-data-export-$env", "hmi-la-sittingpattern-publisher-$env", "hmi-la-sittingpattern-retriever-$env") + $workflowNames=@("hmi-la-dturota-$env", "hmi-la-listing-data-export-$env", "hmi-la-sittingpattern-publisher-$env", "hmi-la-sittingpattern-retriever-$env") $resourceGroupName="hmi-sharedinfra-$env-rg" $kv_name="hmi-shared-kv-$env" - az config set extension.use_dynamic_install=yes_without_prompt - foreach ($workflowName in $workflowNames){ - $workflowIdentity = az logic workflow list --resource-group "$resourceGroupName" --query "[? name=='$workflowName'].identity" --only-show-errors | ConvertFrom-Json - if ($null -eq $workflowIdentity.principalId -or "" -eq $workflowIdentity.principalId ){ Write-Host "No Identities found in $workflowName." } else { Write-Host "$workflowName identities." Write-Host $( $workflowIdentity | ConvertTo-Json) - Write-Host "Give Permissions to $kv_name" $sp_id=$workflowIdentity.principalId az keyvault set-policy --name $kv_name --object-id $sp_id --secret-permissions get list } - } - - \ No newline at end of file + } \ No newline at end of file