Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #619 from hmcts/HMIS-1090-revert-logic-app
Browse files Browse the repository at this point in the history
HMIS-1090 - Revert deployment back to CLI
  • Loading branch information
chris-pateman authored Aug 26, 2022
2 parents 5ddbdb7 + 82330a7 commit 8b35040
Showing 1 changed file with 16 additions and 34 deletions.
50 changes: 16 additions & 34 deletions pipeline/jobs/create-logicapp-dtu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
}

0 comments on commit 8b35040

Please sign in to comment.