Skip to content

Instantly share code, notes, and snippets.

@rrmistry
Last active April 3, 2023 15:20
Show Gist options
  • Save rrmistry/f1c7f91cbd20f7196b195297932ac52c to your computer and use it in GitHub Desktop.
Save rrmistry/f1c7f91cbd20f7196b195297932ac52c to your computer and use it in GitHub Desktop.
Logic App Example
# Using Azure ARM Template deployment instead of logic app deployment because:
# https://github.com/terraform-providers/terraform-provider-azurerm/issues/5197
# https://github.com/terraform-providers/terraform-provider-azurerm/issues/1691
# Until Azure API connections for Azure Logic App is fully supported, this is best
locals {
logicapp_actions = toset([
"dbSetLogging",
"dbUsageMonitor",
"dbGetLOBOwner",
"dbApprovals",
"dbCompression",
"dbCopy",
"dbScale",
"dbDelete",
"dbRestore",
"dbDEVSITRequestForm",
])
}
resource "azurerm_logic_app_workflow" "blank" {
for_each = local.logicapp_actions
name = "${var.project_name}-${each.key}"
resource_group_name = data.azurerm_resource_group.default.name
location = var.az_region
}
resource "azurerm_template_deployment" "logicapps" {
name = "${var.project_name}-logicapp-deployment"
resource_group_name = data.azurerm_resource_group.default.name
parameters = {
project_name = var.project_name
definition_dbSetLogging = file("./dbSetLogging.logicapp.json")
definition_dbUsageMonitor = file("./dbUsageMonitor.logicapp.json")
definition_dbGetLOBOwner = file("./dbGetLOBOwner.logicapp.json")
definition_dbApprovals = file("./dbApprovals.logicapp.json")
definition_dbCompression = file("./dbCompression.logicapp.json")
definition_dbCopy = file("./dbCopy.logicapp.json")
definition_dbScale = file("./dbScale.logicapp.json")
definition_dbDelete = file("./dbDelete.logicapp.json")
definition_dbRestore = file("./dbRestore.logicapp.json")
definition_dbDEVSITRequestForm = file("./dbDEVSITRequestForm.logicapp.json")
sql_username_dev = var.sql_username_dev
sql_password_dev = var.sql_password_dev
az_spn_client_id = var.az_spn_client_id
az_spn_client_secret = var.az_spn_client_secret
az_spn_law_client_id = var.az_spn_law_client_id
az_spn_law_client_secret = var.az_spn_law_client_secret
az_law_resource_group = var.LOG_ANALYTICS_RESOURCE_GROUP
az_law_resource_name = var.LOG_ANALYTICS_RESOURCE_NAME
# Template deployment only takes string parameters
# This gets decoded by ARM template function
tags = jsonencode(var.az_tags)
}
template_body = file("./logicapp.azrm.json")
deployment_mode = "Incremental"
depends_on = [
azurerm_logic_app_workflow.blank
]
}
# Assume exists (department shared Log Analytics Workspace)
data "azurerm_log_analytics_workspace" "sql" {
provider = azurerm.law
name = var.LOG_ANALYTICS_RESOURCE_NAME
resource_group_name = var.LOG_ANALYTICS_RESOURCE_GROUP
}
resource "azurerm_monitor_diagnostic_setting" "monitoring" {
# provider = azurerm.law
for_each = local.logicapp_actions
name = "Push diagnostics data to Log Analytics"
target_resource_id = "/subscriptions/${var.az_subscription_id}/resourceGroups/${var.az_resource_group}/providers/Microsoft.Logic/workflows/${var.project_name}-${each.key}"
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.sql.id
log {
category = "WorkflowRuntime"
enabled = true
retention_policy {
enabled = true
days = 90
}
}
metric {
category = "AllMetrics"
enabled = true
retention_policy {
enabled = true
days = 90
}
}
depends_on = [
azurerm_template_deployment.logicapps,
]
}
{
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Check_If_Database_Exists": {
"actions": {},
"else": {
"actions": {
"Database_does_not_exist": {
"inputs": {
"runStatus": "Cancelled"
},
"runAfter": {
"Let_requester_know_that_database_does_not_exist": [
"Succeeded"
]
},
"type": "Terminate"
},
"Let_requester_know_that_database_does_not_exist": {
"inputs": {
"body": {
"Body": "<p>There was a problem processing your request to scale database \"@{triggerBody()['database']}\" on server \"@{triggerBody()['server']}\"<br>\n<br>\nError Message:<br>@{body('Get_Existing_Database_Details')['error']['message']}<br>\n<br>\nThank you,<br>\nA &amp; E Team<br>\n<br>\n@{triggerBody()?['reference']}</p>",
"From": "@parameters('dbaSharedEmail')",
"Importance": "High",
"Subject": "Database \"@{triggerBody()['database']}\" on server \"@{triggerBody()['server']}\" does not exist",
"To": "@{triggerBody()['requester']}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['office365']['connectionId']"
}
},
"method": "post",
"path": "/v2/Mail"
},
"runAfter": {},
"type": "ApiConnection"
}
}
},
"expression": {
"and": [
{
"equals": [
"@outputs('Get_Existing_Database_Details')['statusCode']",
200
]
}
]
},
"runAfter": {
"Get_Existing_Database_Details": [
"Succeeded",
"Failed"
]
},
"type": "If"
},
"Get_Existing_Database_Details": {
"inputs": {
"authentication": {
"audience": "@parameters('aadAudience')",
"clientId": "@parameters('clientid')",
"secret": "@parameters('clientsecret')",
"tenant": "@parameters('subscription')['tenantId']",
"type": "ActiveDirectoryOAuth"
},
"method": "GET",
"queries": {
"api-version": "2017-10-01-preview"
},
"uri": "https://management.azure.com@{parameters('subscription')['id']}/resourceGroups/@{triggerBody()['resourceGroup']}/providers/Microsoft.Sql/servers/@{triggerBody()['server']}/databases/@{triggerBody()?['database']}"
},
"runAfter": {},
"type": "Http"
},
"Let_requester_know_that_database_is_ready": {
"inputs": {
"body": {
"Body": "<p>Your database @{triggerBody()['database']} on server @{triggerBody()['server']} has completed scaling and is ready<br>\n<br>\nThank you,<br>\nA &amp; E Team<br>\n<br>\n@{triggerBody()?['reference']}</p>",
"Cc": "@body('Send_Approvals')?['Approvers']",
"From": "@parameters('dbaSharedEmail')",
"Importance": "Normal",
"Subject": "Database scaling complete",
"To": "@triggerBody()['requester']"
},
"host": {
"connection": {
"name": "@parameters('$connections')['office365']['connectionId']"
}
},
"method": "post",
"path": "/v2/Mail"
},
"runAfter": {
"Scale_DB": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"Let_requester_know_that_there_was_an_error": {
"inputs": {
"body": {
"Body": "<p>There was an error scaling your database @{triggerBody()['database']} on server @{triggerBody()['server']}<br>\n<br>\nError Message:<br>\n@{body('Scale_DB')['error']['message']}<br>\n<br>\nThank you,<br>\nA &amp; E Team<br>\n<br>\n@{triggerBody()?['reference']}</p>",
"Cc": "@body('Send_Approvals')?['Approvers']",
"From": "@parameters('dbaSharedEmail')",
"Importance": "High",
"Subject": "There was an error scaling @{triggerBody()['database']}",
"To": "@{triggerBody()['requester']}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['office365']['connectionId']"
}
},
"method": "post",
"path": "/v2/Mail"
},
"runAfter": {
"Scale_DB": [
"Failed",
"TimedOut"
]
},
"type": "ApiConnection"
},
"Scale_DB": {
"inputs": {
"authentication": {
"audience": "@parameters('aadAudience')",
"clientId": "@parameters('clientid')",
"secret": "@parameters('clientsecret')",
"tenant": "@parameters('subscription')['tenantId']",
"type": "ActiveDirectoryOAuth"
},
"body": {
"location": "@{parameters('resourceGroup')['location']}",
"sku": {
"name": "@{triggerBody()['skuName']}"
}
},
"headers": {
"Content-Type": "application/json"
},
"method": "PUT",
"queries": {
"api-version": "2017-10-01-preview"
},
"uri": "https://management.azure.com@{parameters('subscription')['id']}/resourceGroups/@{triggerBody()['resourceGroup']}/providers/Microsoft.Sql/servers/@{triggerBody()['server']}/databases/@{triggerBody()['database']}"
},
"runAfter": {
"Try_to_resize_DB": [
"Succeeded",
"Failed",
"TimedOut"
]
},
"type": "Http"
},
"Send_Approvals": {
"inputs": {
"body": {
"action": "scale database \"@{triggerBody()['database']}\" on server \"@{triggerBody()['server']}\"",
"database": "@triggerBody()['database']",
"executiveApprovers": false,
"isAutomated": "@triggerBody()?['isAutomated']",
"message": "<p>\nThe user \"@{triggerBody()['requester']}\" is requesting to scale database \"@{triggerBody()['database']}\" on server \"@{triggerBody()['server']}\".<br>\n<br>\nCurrent database properties:<br>\nCurrent scale: \"@{body('Get_Existing_Database_Details')['properties']['currentServiceObjectiveName']}\".<br>\nSize on disk (bytes): \"@{body('Get_Existing_Database_Details')['properties']['maxSizeBytes']}\".<br>\n<br>\nRequested scale: \"@{triggerBody()['skuName']}\".<br>\nNew disk size: @{triggerBody()?['newMaxDiskSize']}<br>\n@{if(not(equals(triggerBody()?['expectedMonthlyCost'], null)), concat('Expected monthly cost: ', triggerBody()?['expectedMonthlyCost'], '<br>'), '')}\n<br>\n@{if(greater(length(triggerBody()['message']), 0), concat('Additional Comments: ', triggerBody()['message']), '')}</p>",
"reference": "@triggerBody()?['reference']",
"requester": "@triggerBody()['requester']",
"resourceGroup": "@triggerBody()['resourceGroup']",
"server": "@triggerBody()['server']",
"subject": "Approve SQL database scaling request"
},
"host": {
"triggerName": "manual",
"workflow": {
"id": "LOGICAPP_RESOURCEGROUPID_PLACEHOLDER/providers/Microsoft.Logic/workflows/vstsqldevops-dbApprovals"
}
},
"retryPolicy": {
"type": "none"
}
},
"runAfter": {
"Check_If_Database_Exists": [
"Succeeded"
]
},
"type": "Workflow"
},
"Terminate_after_rejection_or_time_out": {
"inputs": {
"runStatus": "Cancelled"
},
"runAfter": {
"Send_Approvals": [
"Failed",
"TimedOut"
]
},
"type": "Terminate"
},
"Terminate_with_failure": {
"inputs": {
"runError": {
"code": "500",
"message": "@{body('Scale_DB')['error']['message']}"
},
"runStatus": "Failed"
},
"runAfter": {
"Let_requester_know_that_there_was_an_error": [
"Succeeded"
]
},
"type": "Terminate"
},
"Try_to_resize_DB": {
"actions": {
"Read_database_size_statistics": {
"inputs": {
"body": "AzureMetrics\n| where TimeGenerated > ago(30m)\n| where ResourceId =~ \"@{parameters('subscription')['id']}/resourceGroups/@{triggerBody()['resourceGroup']}/providers/Microsoft.Sql/servers/@{triggerBody()['server']}/databases/@{triggerBody()['database']}\" \n| where MetricName in (\"allocated_data_storage\" , \"tempdb_data_size\", \"tempdb_log_size\")\n| summarize max(Maximum) by Resource\n| summarize sum(max_Maximum)",
"host": {
"connection": {
"name": "@parameters('$connections')['azuremonitorlogs']['connectionId']"
}
},
"method": "post",
"path": "/queryData",
"queries": {
"resourcegroups": "@parameters('az_law_resource_group')",
"resourcename": "@parameters('az_law_resource_name')",
"resourcetype": "Log Analytics Workspace",
"subscriptions": "@parameters('subscription')?['subscriptionId']",
"timerange": "Set in query"
}
},
"runAfter": {},
"type": "ApiConnection"
},
"Resize_DB": {
"inputs": {
"authentication": {
"audience": "@parameters('aadAudience')",
"clientId": "@parameters('clientid')",
"secret": "@parameters('clientsecret')",
"tenant": "@parameters('subscription')['tenantId']",
"type": "ActiveDirectoryOAuth"
},
"body": {
"location": "@{parameters('resourceGroup')['location']}",
"properties": {
"maxSizeBytes": "@mul(add(1, int(div(int(body('Read_database_size_statistics')?['value']?[0]?['sum_max_Maximum']), 1073741824))), 1073741824)"
}
},
"headers": {
"Content-Type": "application/json"
},
"method": "PUT",
"queries": {
"api-version": "2017-10-01-preview"
},
"uri": "https://management.azure.com@{parameters('subscription')['id']}/resourceGroups/@{triggerBody()['resourceGroup']}/providers/Microsoft.Sql/servers/@{triggerBody()['server']}/databases/@{triggerBody()['database']}"
},
"runAfter": {
"Read_database_size_statistics": [
"Succeeded"
]
},
"type": "Http"
}
},
"runAfter": {
"Send_Approvals": [
"Succeeded"
]
},
"type": "Scope"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
},
"aadAudience": {
"defaultValue": "https://management.azure.com/",
"type": "String"
},
"az_law_resource_group": {
"defaultValue": "",
"type": "String"
},
"az_law_resource_name": {
"defaultValue": "",
"type": "String"
},
"clientid": {
"defaultValue": "",
"type": "String"
},
"clientsecret": {
"defaultValue": "",
"type": "SecureString"
},
"dbaSharedEmail": {
"defaultValue": "[email protected]",
"type": "String"
},
"project_name": {
"defaultValue": "",
"type": "String"
},
"resourceGroup": {
"defaultValue": {},
"type": "Object"
},
"subscription": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"conditions": [],
"inputs": {
"schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"database": {
"$id": "#/properties/database",
"title": "Database",
"type": "string"
},
"expectedMonthlyCost": {
"$id": "#/properties/expectedMonthlyCost",
"title": "Expected Monthly Cost",
"type": "string"
},
"isAutomated": {
"$id": "#/properties/isAutomated",
"title": "Is Automated Request",
"type": "boolean"
},
"message": {
"$id": "#/properties/message",
"title": "Message",
"type": "string"
},
"newMaxDiskSize": {
"$id": "#/properties/newMaxDiskSize",
"title": "New Maximum disk size",
"type": "string"
},
"reference": {
"$id": "#/properties/reference",
"title": "Reference",
"type": "string"
},
"requester": {
"$id": "#/properties/requester",
"title": "Requester",
"type": "string"
},
"resourceGroup": {
"$id": "#/properties/resourceGroup",
"title": "Resource Group",
"type": "string"
},
"server": {
"$id": "#/properties/server",
"title": "Server",
"type": "string"
},
"skuName": {
"$id": "#/properties/skuName",
"title": "SKU Name",
"type": "string"
}
},
"required": [
"resourceGroup",
"server",
"database",
"requester",
"skuName"
],
"type": "object"
}
},
"kind": "Http",
"operationOptions": "EnableSchemaValidation",
"type": "Request"
}
}
}
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"project_name": {
"type": "string",
"defaultValue": ""
},
"definition_dbSetLogging": {
"defaultValue": "{}",
"type": "string"
},
"definition_dbUsageMonitor": {
"defaultValue": "{}",
"type": "string"
},
"definition_dbGetLOBOwner": {
"defaultValue": "{}",
"type": "string"
},
"definition_dbApprovals": {
"defaultValue": "{}",
"type": "string"
},
"definition_dbCompression": {
"defaultValue": "{}",
"type": "string"
},
"definition_dbCopy": {
"defaultValue": "{}",
"type": "string"
},
"definition_dbScale": {
"defaultValue": "{}",
"type": "string"
},
"definition_dbDelete": {
"defaultValue": "{}",
"type": "string"
},
"definition_dbRestore": {
"defaultValue": "{}",
"type": "string"
},
"definition_dbDEVSITRequestForm": {
"defaultValue": "{}",
"type": "string"
},
"logicAppState": {
"defaultValue": "Enabled",
"type": "string"
},
"sql_username_dev": {
"defaultValue": "",
"type": "string"
},
"sql_password_dev": {
"defaultValue": "",
"type": "securestring"
},
"az_spn_client_id": {
"defaultValue": "",
"type": "string"
},
"az_spn_client_secret": {
"type": "securestring",
"defaultValue": ""
},
"az_spn_law_client_id": {
"defaultValue": "",
"type": "string"
},
"az_spn_law_client_secret": {
"type": "securestring",
"defaultValue": ""
},
"az_law_resource_group": {
"defaultValue": "",
"type": "string"
},
"az_law_resource_name": {
"defaultValue": "",
"type": "string"
},
"tags": {
"defaultValue": "{}",
"type": "string"
}
},
"variables": {
"logicapp_resourceGroupId_placeholder": "LOGICAPP_RESOURCEGROUPID_PLACEHOLDER",
"logicapp_resourceGroupId_value": "[resourceGroup().id]"
},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[concat(parameters('project_name'), '-azureloganalytics')]",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"properties": {
"displayName": "[concat(parameters('project_name'), '-azureloganalytics')]",
"customParameterValues": {
},
"api": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azureloganalytics')]"
}
}
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[concat(parameters('project_name'), '-azuremonitorlogs')]",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"properties": {
"displayName": "[concat(parameters('project_name'), '-azuremonitorlogs')]",
"customParameterValues": {
},
"api": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuremonitorlogs')]"
}
}
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[concat(parameters('project_name'), '-excelonlinebusiness')]",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"properties": {
"displayName": "[concat(parameters('project_name'), '-excelonlinebusiness')]",
"customParameterValues": {
},
"api": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/excelonlinebusiness')]"
}
}
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[concat(parameters('project_name'), '-microsoftforms')]",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"properties": {
"displayName": "[concat(parameters('project_name'), '-microsoftforms')]",
"customParameterValues": {
},
"api": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/microsoftforms')]"
}
}
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[concat(parameters('project_name'), '-office365')]",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"properties": {
"displayName": "[concat(parameters('project_name'), '-office365')]",
"customParameterValues": {
},
"api": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/office365')]"
}
}
},
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[concat(parameters('project_name'), '-powerbi')]",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"properties": {
"displayName": "[concat(parameters('project_name'), '-powerbi')]",
"customParameterValues": {
},
"api": {
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/powerbi')]"
}
}
},
{
"apiVersion": "2016-10-01",
"name": "[concat(parameters('project_name'), '-dbSetLogging')]",
"type": "Microsoft.Logic/workflows",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"dependsOn": [
"[concat(parameters('project_name'), '-azuremonitorlogs')]"
],
"properties": {
"definition": "[json(replace(parameters('definition_dbSetLogging'), variables('logicapp_resourceGroupId_placeholder'), variables('logicapp_resourceGroupId_value')))]",
"parameters": {
"clientid": {
"value": "[parameters('az_spn_law_client_id')]"
},
"clientsecret": {
"value": "[parameters('az_spn_law_client_secret')]"
},
"project_name": {
"value": "[parameters('project_name')]"
},
"resourceGroup": {
"value": "[resourceGroup()]"
},
"subscription": {
"value": "[subscription()]"
},
"az_law_resource_group": {
"value": "[parameters('az_law_resource_group')]"
},
"az_law_resource_name": {
"value": "[parameters('az_law_resource_name')]"
},
"$connections": {
"value": {
"azuremonitorlogs": {
"connectionId": "[resourceId('Microsoft.Web/connections', concat(parameters('project_name'), '-azuremonitorlogs'))]",
"connectionName": "[concat(parameters('project_name'), '-azuremonitorlogs')]",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuremonitorlogs')]"
}
}
}
},
"state": "[parameters('logicAppState')]"
}
},
{
"apiVersion": "2016-10-01",
"name": "[concat(parameters('project_name'), '-dbUsageMonitor')]",
"type": "Microsoft.Logic/workflows",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"dependsOn": [
"[concat(parameters('project_name'), '-azuremonitorlogs')]",
"[concat(parameters('project_name'), '-office365')]"
],
"properties": {
"definition": "[json(replace(parameters('definition_dbUsageMonitor'), variables('logicapp_resourceGroupId_placeholder'), variables('logicapp_resourceGroupId_value')))]",
"parameters": {
"clientid": {
"value": "[parameters('az_spn_law_client_id')]"
},
"clientsecret": {
"value": "[parameters('az_spn_law_client_secret')]"
},
"project_name": {
"value": "[parameters('project_name')]"
},
"resourceGroup": {
"value": "[resourceGroup()]"
},
"subscription": {
"value": "[subscription()]"
},
"az_law_resource_group": {
"value": "[parameters('az_law_resource_group')]"
},
"az_law_resource_name": {
"value": "[parameters('az_law_resource_name')]"
},
"$connections": {
"value": {
"azuremonitorlogs": {
"connectionId": "[resourceId('Microsoft.Web/connections', concat(parameters('project_name'), '-azuremonitorlogs'))]",
"connectionName": "[concat(parameters('project_name'), '-azuremonitorlogs')]",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuremonitorlogs')]"
},
"office365": {
"connectionId": "[resourceId('Microsoft.Web/connections', concat(parameters('project_name'), '-office365'))]",
"connectionName": "[concat(parameters('project_name'), '-office365')]",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/office365')]"
}
}
}
},
"state": "[parameters('logicAppState')]"
}
},
{
"apiVersion": "2016-10-01",
"name": "[concat(parameters('project_name'), '-dbGetLOBOwner')]",
"type": "Microsoft.Logic/workflows",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"dependsOn": [
"[concat(parameters('project_name'), '-excelonlinebusiness')]"
],
"properties": {
"definition": "[json(replace(parameters('definition_dbGetLOBOwner'), variables('logicapp_resourceGroupId_placeholder'), variables('logicapp_resourceGroupId_value')))]",
"parameters": {
"clientid": {
"value": "[parameters('az_spn_client_id')]"
},
"clientsecret": {
"value": "[parameters('az_spn_client_secret')]"
},
"project_name": {
"value": "[parameters('project_name')]"
},
"resourceGroup": {
"value": "[resourceGroup()]"
},
"subscription": {
"value": "[subscription()]"
},
"$connections": {
"value": {
"excelonlinebusiness": {
"connectionId": "[resourceId('Microsoft.Web/connections', concat(parameters('project_name'), '-excelonlinebusiness'))]",
"connectionName": "[concat(parameters('project_name'), '-excelonlinebusiness')]",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/excelonlinebusiness')]"
}
}
}
},
"state": "[parameters('logicAppState')]"
}
},
{
"apiVersion": "2016-10-01",
"name": "[concat(parameters('project_name'), '-dbApprovals')]",
"type": "Microsoft.Logic/workflows",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"dependsOn": [
"[concat(parameters('project_name'), '-dbGetLOBOwner')]",
"[concat(parameters('project_name'), '-office365')]"
],
"properties": {
"definition": "[json(replace(parameters('definition_dbApprovals'), variables('logicapp_resourceGroupId_placeholder'), variables('logicapp_resourceGroupId_value')))]",
"parameters": {
"clientid": {
"value": "[parameters('az_spn_client_id')]"
},
"clientsecret": {
"value": "[parameters('az_spn_client_secret')]"
},
"project_name": {
"value": "[parameters('project_name')]"
},
"resourceGroup": {
"value": "[resourceGroup()]"
},
"subscription": {
"value": "[subscription()]"
},
"$connections": {
"value": {
"office365": {
"connectionId": "[resourceId('Microsoft.Web/connections', concat(parameters('project_name'), '-office365'))]",
"connectionName": "[concat(parameters('project_name'), '-office365')]",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/office365')]"
}
}
}
},
"state": "[parameters('logicAppState')]"
}
},
{
"apiVersion": "2016-10-01",
"name": "[concat(parameters('project_name'), '-dbCompression')]",
"type": "Microsoft.Logic/workflows",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"dependsOn": [
"[concat(parameters('project_name'), '-dbApprovals')]",
"[concat(parameters('project_name'), '-office365')]"
],
"properties": {
"definition": "[json(replace(parameters('definition_dbCompression'), variables('logicapp_resourceGroupId_placeholder'), variables('logicapp_resourceGroupId_value')))]",
"parameters": {
"clientid": {
"value": "[parameters('az_spn_client_id')]"
},
"clientsecret": {
"value": "[parameters('az_spn_client_secret')]"
},
"project_name": {
"value": "[parameters('project_name')]"
},
"resourceGroup": {
"value": "[resourceGroup()]"
},
"sql_username_dev": {
"value": "[parameters('sql_username_dev')]"
},
"sql_password_dev": {
"value": "[parameters('sql_password_dev')]"
},
"subscription": {
"value": "[subscription()]"
},
"$connections": {
"value": {
"office365": {
"connectionId": "[resourceId('Microsoft.Web/connections', concat(parameters('project_name'), '-office365'))]",
"connectionName": "[concat(parameters('project_name'), '-office365')]",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/office365')]"
}
}
}
},
"state": "[parameters('logicAppState')]"
}
},
{
"apiVersion": "2016-10-01",
"name": "[concat(parameters('project_name'), '-dbCopy')]",
"type": "Microsoft.Logic/workflows",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"dependsOn": [
"[concat(parameters('project_name'), '-dbApprovals')]",
"[concat(parameters('project_name'), '-office365')]"
],
"properties": {
"definition": "[json(replace(parameters('definition_dbCopy'), variables('logicapp_resourceGroupId_placeholder'), variables('logicapp_resourceGroupId_value')))]",
"parameters": {
"clientid": {
"value": "[parameters('az_spn_client_id')]"
},
"clientsecret": {
"value": "[parameters('az_spn_client_secret')]"
},
"project_name": {
"value": "[parameters('project_name')]"
},
"resourceGroup": {
"value": "[resourceGroup()]"
},
"subscription": {
"value": "[subscription()]"
},
"$connections": {
"value": {
"office365": {
"connectionId": "[resourceId('Microsoft.Web/connections', concat(parameters('project_name'), '-office365'))]",
"connectionName": "[concat(parameters('project_name'), '-office365')]",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/office365')]"
}
}
}
},
"state": "[parameters('logicAppState')]"
}
},
{
"apiVersion": "2016-10-01",
"name": "[concat(parameters('project_name'), '-dbScale')]",
"type": "Microsoft.Logic/workflows",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"dependsOn": [
"[concat(parameters('project_name'), '-dbApprovals')]",
"[concat(parameters('project_name'), '-azuremonitorlogs')]",
"[concat(parameters('project_name'), '-office365')]"
],
"properties": {
"definition": "[json(replace(parameters('definition_dbScale'), variables('logicapp_resourceGroupId_placeholder'), variables('logicapp_resourceGroupId_value')))]",
"parameters": {
"clientid": {
"value": "[parameters('az_spn_client_id')]"
},
"clientsecret": {
"value": "[parameters('az_spn_client_secret')]"
},
"project_name": {
"value": "[parameters('project_name')]"
},
"resourceGroup": {
"value": "[resourceGroup()]"
},
"subscription": {
"value": "[subscription()]"
},
"az_law_resource_group": {
"value": "[parameters('az_law_resource_group')]"
},
"az_law_resource_name": {
"value": "[parameters('az_law_resource_name')]"
},
"$connections": {
"value": {
"azuremonitorlogs": {
"connectionId": "[resourceId('Microsoft.Web/connections', concat(parameters('project_name'), '-azuremonitorlogs'))]",
"connectionName": "[concat(parameters('project_name'), '-azuremonitorlogs')]",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/azuremonitorlogs')]"
},
"office365": {
"connectionId": "[resourceId('Microsoft.Web/connections', concat(parameters('project_name'), '-office365'))]",
"connectionName": "[concat(parameters('project_name'), '-office365')]",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/office365')]"
}
}
}
},
"state": "[parameters('logicAppState')]"
}
},
{
"apiVersion": "2016-10-01",
"name": "[concat(parameters('project_name'), '-dbDelete')]",
"type": "Microsoft.Logic/workflows",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"dependsOn": [
"[concat(parameters('project_name'), '-dbApprovals')]",
"[concat(parameters('project_name'), '-office365')]"
],
"properties": {
"definition": "[json(replace(parameters('definition_dbDelete'), variables('logicapp_resourceGroupId_placeholder'), variables('logicapp_resourceGroupId_value')))]",
"parameters": {
"clientid": {
"value": "[parameters('az_spn_client_id')]"
},
"clientsecret": {
"value": "[parameters('az_spn_client_secret')]"
},
"project_name": {
"value": "[parameters('project_name')]"
},
"resourceGroup": {
"value": "[resourceGroup()]"
},
"subscription": {
"value": "[subscription()]"
},
"$connections": {
"value": {
"office365": {
"connectionId": "[resourceId('Microsoft.Web/connections', concat(parameters('project_name'), '-office365'))]",
"connectionName": "[concat(parameters('project_name'), '-office365')]",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/office365')]"
}
}
}
},
"state": "[parameters('logicAppState')]"
}
},
{
"apiVersion": "2016-10-01",
"name": "[concat(parameters('project_name'), '-dbRestore')]",
"type": "Microsoft.Logic/workflows",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"dependsOn": [
"[concat(parameters('project_name'), '-dbApprovals')]",
"[concat(parameters('project_name'), '-office365')]"
],
"properties": {
"definition": "[json(replace(parameters('definition_dbRestore'), variables('logicapp_resourceGroupId_placeholder'), variables('logicapp_resourceGroupId_value')))]",
"parameters": {
"clientid": {
"value": "[parameters('az_spn_client_id')]"
},
"clientsecret": {
"value": "[parameters('az_spn_client_secret')]"
},
"project_name": {
"value": "[parameters('project_name')]"
},
"resourceGroup": {
"value": "[resourceGroup()]"
},
"subscription": {
"value": "[subscription()]"
},
"$connections": {
"value": {
"office365": {
"connectionId": "[resourceId('Microsoft.Web/connections', concat(parameters('project_name'), '-office365'))]",
"connectionName": "[concat(parameters('project_name'), '-office365')]",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/office365')]"
}
}
}
},
"state": "[parameters('logicAppState')]"
}
},
{
"apiVersion": "2016-10-01",
"name": "[concat(parameters('project_name'), '-dbDEVSITRequestForm')]",
"type": "Microsoft.Logic/workflows",
"location": "[resourceGroup().location]",
"tags": "[json(parameters('tags'))]",
"dependsOn": [
"[concat(parameters('project_name'), '-dbCopy')]",
"[concat(parameters('project_name'), '-dbScale')]",
"[concat(parameters('project_name'), '-dbDelete')]",
"[concat(parameters('project_name'), '-dbRestore')]",
"[concat(parameters('project_name'), '-dbCompression')]",
"[concat(parameters('project_name'), '-microsoftforms')]",
"[concat(parameters('project_name'), '-office365')]"
],
"properties": {
"definition": "[json(replace(parameters('definition_dbDEVSITRequestForm'), variables('logicapp_resourceGroupId_placeholder'), variables('logicapp_resourceGroupId_value')))]",
"parameters": {
"clientid": {
"value": "[parameters('az_spn_client_id')]"
},
"clientsecret": {
"value": "[parameters('az_spn_client_secret')]"
},
"project_name": {
"value": "[parameters('project_name')]"
},
"resourceGroup": {
"value": "[resourceGroup()]"
},
"subscription": {
"value": "[subscription()]"
},
"$connections": {
"value": {
"microsoftforms": {
"connectionId": "[resourceId('Microsoft.Web/connections', concat(parameters('project_name'), '-microsoftforms'))]",
"connectionName": "[concat(parameters('project_name'), '-microsoftforms')]",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/microsoftforms')]"
},
"office365": {
"connectionId": "[resourceId('Microsoft.Web/connections', concat(parameters('project_name'), '-office365'))]",
"connectionName": "[concat(parameters('project_name'), '-office365')]",
"id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', resourceGroup().location, '/managedApis/office365')]"
}
}
}
},
"state": "[parameters('logicAppState')]"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment