-
-
Save aaronpowell/a2f87eefcff320df39645c3570584599 to your computer and use it in GitHub Desktop.
HIBP Microsoft Flow and Connector for Outlook Tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"logicAppName": { | |
"type": "String", | |
"metadata": { | |
"description": "HIBP -> Outlook Tasks" | |
} | |
}, | |
"logicAppLocation": { | |
"defaultValue": "[resourceGroup().location]", | |
"allowedValues": ["eastasia", "southeastasia", "centralus", "eastus", "eastus2", "westus", "northcentralus", "southcentralus", "northeurope", "westeurope", "japanwest", "japaneast", "brazilsouth", "australiaeast", "australiasoutheast", "southindia", "centralindia", "westindia", "canadacentral", "canadaeast", "westcentralus", "westus2", "[resourceGroup().location]"], | |
"type": "String", | |
"metadata": { | |
"description": "Create a todo item in Outlook Tasks when you're breached according to HIBP" | |
} | |
}, | |
"rss_Connection_Name": { | |
"defaultValue": "rss", | |
"type": "String", | |
"metadata": { | |
"description": "Name of the connection." | |
} | |
}, | |
"microsoft.20todo.5f77db65e148be4a14.5ffb1b64cc77058181_Connection_Name": { | |
"defaultValue": "microsoft.20todo.5f77db65e148be4a14.5ffb1b64cc77058181", | |
"type": "String", | |
"metadata": { | |
"description": "Name of the connection." | |
} | |
} | |
}, | |
"resources": [{ | |
"type": "Microsoft.Logic/workflows", | |
"name": "[parameters('logicAppName')]", | |
"apiVersion": "2016-06-01", | |
"location": "[parameters('logicAppLocation')]", | |
"properties": { | |
"state": "Disabled", | |
"definition": { | |
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"$connections": { | |
"defaultValue": {}, | |
"type": "Object" | |
}, | |
"$authentication": { | |
"defaultValue": {}, | |
"type": "SecureObject" | |
} | |
}, | |
"triggers": { | |
"When_a_feed_item_is_published": { | |
"recurrence": { | |
"interval": 5, | |
"frequency": "Minute" | |
}, | |
"splitOn": "@triggerBody()?['value']", | |
"type": "ApiConnection", | |
"inputs": { | |
"host": { | |
"connection": { | |
"name": "@parameters('$connections')['rss']['connectionId']" | |
} | |
}, | |
"method": "get", | |
"path": "/OnNewFeed", | |
"queries": { | |
"feedUrl": "https://feeds.feedburner.com/HaveIBeenPwnedLatestBreaches" | |
}, | |
"authentication": "@parameters('$authentication')" | |
} | |
} | |
}, | |
"actions": { | |
"Parse_JSON": { | |
"runAfter": { | |
"Get_breach_details": ["Succeeded"] | |
}, | |
"type": "ParseJson", | |
"inputs": { | |
"content": "@body('Get_breach_details')", | |
"schema": { | |
"type": "object", | |
"properties": { | |
"Title": { | |
"type": "string" | |
}, | |
"Name": { | |
"type": "string" | |
}, | |
"Domain": { | |
"type": "string" | |
}, | |
"BreachDate": { | |
"type": "string" | |
}, | |
"AddedDate": { | |
"type": "string" | |
}, | |
"ModifiedDate": { | |
"type": "string" | |
}, | |
"PwnCount": { | |
"type": "number" | |
}, | |
"Description": { | |
"type": "string" | |
}, | |
"DataClasses": { | |
"type": "array", | |
"items": { | |
"type": "string" | |
} | |
}, | |
"IsVerified": { | |
"type": "boolean" | |
}, | |
"IsFabricated": { | |
"type": "boolean" | |
}, | |
"IsSensitive": { | |
"type": "boolean" | |
}, | |
"IsActive": { | |
"type": "boolean" | |
}, | |
"IsRetired": { | |
"type": "boolean" | |
}, | |
"IsSpamList": { | |
"type": "boolean" | |
}, | |
"LogoType": { | |
"type": "string" | |
} | |
} | |
} | |
} | |
}, | |
"Get_breach_for_account": { | |
"runAfter": { | |
"Parse_JSON": ["Succeeded"] | |
}, | |
"type": "Http", | |
"inputs": { | |
"method": "GET", | |
"uri": "https://haveibeenpwned.com/api/v2/breachedaccount/YOUR_EMAIL_HERE?domain=@{body('Parse_JSON')?['Domain']}" | |
} | |
}, | |
"Condition": { | |
"actions": { | |
"Create_todo_in_folder": { | |
"runAfter": {}, | |
"type": "ApiConnection", | |
"inputs": { | |
"host": { | |
"connection": { | |
"name": "@parameters('$connections')['microsoft.20todo.5f77db65e148be4a14.5ffb1b64cc77058181']['connectionId']" | |
} | |
}, | |
"method": "post", | |
"path": "/api/v2.0/me/tasks", | |
"headers": { | |
"content-type": "application/json" | |
}, | |
"body": { | |
"Subject": "Update password for @{body('Parse_JSON')?['Domain']}", | |
"StartDateTime": { | |
"DateTime": "@body('Parse_JSON')?['AddedDate']", | |
"TimeZone": "Pacific Central Time" | |
}, | |
"DueDateTime": { | |
"DateTime": "@{addDays(body('Parse_JSON')?['AddedDate'], 1)}", | |
"TimeZone": "Pacific Central Time" | |
} | |
}, | |
"authentication": "@parameters('$authentication')" | |
} | |
} | |
}, | |
"runAfter": { | |
"Get_breach_for_account": ["Succeeded"] | |
}, | |
"expression": "@equals(outputs('Get_breach_for_account')['statusCode'], 200)", | |
"type": "If" | |
}, | |
"Get_breach_details": { | |
"runAfter": {}, | |
"type": "Http", | |
"inputs": { | |
"method": "GET", | |
"uri": "https://haveibeenpwned.com/api/v2/breach/@{triggerBody()?['id']}" | |
} | |
} | |
}, | |
"description": "Creates a todo item when I am detected in an account breach" | |
}, | |
"parameters": { | |
"$connections": { | |
"value": { | |
"rss": { | |
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'rss')]", | |
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('rss_Connection_Name'))]", | |
"connectionName": "[parameters('rss_Connection_Name')]" | |
}, | |
"microsoft.20todo.5f77db65e148be4a14.5ffb1b64cc77058181": { | |
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'microsoft.20todo.5f77db65e148be4a14.5ffb1b64cc77058181')]", | |
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('microsoft.20todo.5f77db65e148be4a14.5ffb1b64cc77058181_Connection_Name'))]", | |
"connectionName": "[parameters('microsoft.20todo.5f77db65e148be4a14.5ffb1b64cc77058181_Connection_Name')]" | |
} | |
} | |
} | |
} | |
}, | |
"dependsOn": ["[resourceId('Microsoft.Web/connections', parameters('rss_Connection_Name'))]", "[resourceId('Microsoft.Web/connections', parameters('microsoft.20todo.5f77db65e148be4a14.5ffb1b64cc77058181_Connection_Name'))]"] | |
}, { | |
"type": "Microsoft.Web/connections", | |
"name": "[parameters('rss_Connection_Name')]", | |
"apiVersion": "2016-06-01", | |
"location": "[parameters('logicAppLocation')]", | |
"properties": { | |
"api": { | |
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'rss')]" | |
}, | |
"displayName": "[parameters('rss_Connection_Name')]" | |
} | |
}, { | |
"type": "Microsoft.Web/connections", | |
"name": "[parameters('microsoft.20todo.5f77db65e148be4a14.5ffb1b64cc77058181_Connection_Name')]", | |
"apiVersion": "2016-06-01", | |
"location": "[parameters('logicAppLocation')]", | |
"properties": { | |
"api": { | |
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'microsoft.20todo.5f77db65e148be4a14.5ffb1b64cc77058181')]" | |
}, | |
"displayName": "[parameters('microsoft.20todo.5f77db65e148be4a14.5ffb1b64cc77058181_Connection_Name')]" | |
} | |
}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "Microsoft ToDo", | |
"description": "Connection to Microsoft Todo", | |
"version": "1.0" | |
}, | |
"host": "outlook.office.com", | |
"basePath": "/", | |
"schemes": [], | |
"consumes": [], | |
"produces": [], | |
"paths": { | |
"/api/v2.0/me/tasks": { | |
"get": { | |
"responses": { | |
"default": { | |
"description": "default", | |
"schema": { | |
"type": "string" | |
} | |
} | |
}, | |
"summary": "Get Tasks", | |
"description": "Get all the Tasks you have created", | |
"operationId": "Get-tasks", | |
"parameters": [] | |
}, | |
"post": { | |
"responses": { | |
"default": { | |
"description": "default", | |
"schema": { | |
"type": "string" | |
} | |
} | |
}, | |
"summary": "Create Task", | |
"description": "Creates a new task against a task folder", | |
"operationId": "Todo-task-create", | |
"parameters": [ | |
{ | |
"name": "Content-Type", | |
"in": "header", | |
"required": true, | |
"type": "string", | |
"default": "application/json", | |
"x-ms-visibility": "internal" | |
}, | |
{ | |
"name": "body", | |
"in": "body", | |
"required": true, | |
"schema": { | |
"type": "object", | |
"properties": { | |
"Subject": { | |
"type": "string", | |
"description": "Subject", | |
"x-ms-summary": "Subject" | |
}, | |
"StartDateTime": { | |
"type": "object", | |
"properties": { | |
"DateTime": { | |
"type": "string", | |
"format": "date-time", | |
"description": "DateTime", | |
"x-ms-summary": "DateTime" | |
}, | |
"TimeZone": { | |
"type": "string", | |
"description": "TimeZone", | |
"x-ms-summary": "TimeZone", | |
"title": "TimeZone", | |
"x-ms-visibility": "advanced", | |
"default": "Pacific Standard Time" | |
} | |
}, | |
"description": "StartDateTime", | |
"x-ms-summary": "StartDateTime" | |
}, | |
"DueDateTime": { | |
"type": "object", | |
"properties": { | |
"DateTime": { | |
"type": "string", | |
"format": "date-time", | |
"description": "DateTime", | |
"x-ms-summary": "DateTime" | |
}, | |
"TimeZone": { | |
"type": "string", | |
"description": "TimeZone", | |
"x-ms-summary": "TimeZone", | |
"title": "TimeZone", | |
"x-ms-visibility": "advanced", | |
"default": "Pacific Standard Time" | |
} | |
}, | |
"description": "DueDateTime", | |
"x-ms-summary": "DueDateTime" | |
} | |
} | |
} | |
} | |
] | |
} | |
}, | |
"/api/v2.0/me/taskfolders('{folder_id}')/tasks": { | |
"get": { | |
"responses": { | |
"default": { | |
"description": "default", | |
"schema": { | |
"type": "string" | |
} | |
} | |
}, | |
"summary": "Get Tasks in Folder", | |
"description": "Gets all the tasks in a specific folder", | |
"operationId": "Get-tasks-folder", | |
"parameters": [ | |
{ | |
"name": "folder_id", | |
"in": "path", | |
"required": true, | |
"type": "string", | |
"description": "ID of the folder", | |
"x-ms-summary": "ID of the folder which the tasks reside within", | |
"x-ms-visibility": "important" | |
} | |
] | |
}, | |
"post": { | |
"responses": { | |
"default": { | |
"description": "default", | |
"schema": { | |
"type": "string" | |
} | |
} | |
}, | |
"summary": "Create todo in folder", | |
"description": "Creates a todo item in a specific folder", | |
"operationId": "Todo-task-create-folder", | |
"parameters": [ | |
{ | |
"name": "folder_id", | |
"in": "path", | |
"required": true, | |
"type": "string", | |
"description": "Task Folder ID", | |
"x-ms-summary": "The id of the task folder that you want to create the item under" | |
}, | |
{ | |
"name": "content-type", | |
"in": "header", | |
"required": true, | |
"type": "string", | |
"default": "application/json", | |
"x-ms-visibility": "internal" | |
}, | |
{ | |
"name": "body", | |
"in": "body", | |
"required": false, | |
"schema": { | |
"type": "object", | |
"properties": { | |
"Subject": { | |
"type": "string", | |
"description": "Subject", | |
"x-ms-summary": "Subject", | |
"title": "Subject", | |
"x-ms-visibility": "" | |
}, | |
"StartDateTime": { | |
"type": "object", | |
"properties": { | |
"DateTime": { | |
"type": "string", | |
"format": "date-time", | |
"description": "DateTime", | |
"x-ms-summary": "DateTime", | |
"title": "DateTime", | |
"x-ms-visibility": "" | |
}, | |
"TimeZone": { | |
"type": "string", | |
"description": "TimeZone", | |
"x-ms-summary": "TimeZone", | |
"title": "TimeZone", | |
"x-ms-visibility": "internal", | |
"default": "Pacific Central Time" | |
} | |
}, | |
"description": "StartDateTime", | |
"x-ms-summary": "StartDateTime", | |
"required": [ | |
"TimeZone", | |
"DateTime" | |
] | |
}, | |
"DueDateTime": { | |
"type": "object", | |
"properties": { | |
"DateTime": { | |
"type": "string", | |
"format": "date-time", | |
"description": "DateTime", | |
"x-ms-summary": "DateTime", | |
"title": "DateTime", | |
"x-ms-visibility": "" | |
}, | |
"TimeZone": { | |
"type": "string", | |
"description": "TimeZone", | |
"x-ms-summary": "TimeZone", | |
"title": "TimeZone", | |
"x-ms-visibility": "internal", | |
"default": "Pacific Central Time" | |
} | |
}, | |
"description": "DueDateTime", | |
"x-ms-summary": "DueDateTime", | |
"required": [ | |
"TimeZone", | |
"DateTime" | |
] | |
} | |
}, | |
"required": [ | |
"DueDateTime", | |
"StartDateTime", | |
"Subject" | |
] | |
} | |
} | |
] | |
} | |
}, | |
"/api/v2.0/me/taskgroups": { | |
"get": { | |
"responses": { | |
"default": { | |
"description": "default", | |
"schema": { | |
"type": "string" | |
} | |
} | |
}, | |
"summary": "Get Task Groups", | |
"description": "Gets all the task groups you have in your workspace", | |
"operationId": "Get-task-groups", | |
"parameters": [] | |
} | |
}, | |
"/api/v2.0/me/taskfolders": { | |
"get": { | |
"responses": { | |
"default": { | |
"description": "default", | |
"schema": { | |
"type": "string" | |
} | |
} | |
}, | |
"summary": "Get Task Folders", | |
"description": "Get the task folders in your workspace", | |
"operationId": "Get-task-folders", | |
"parameters": [] | |
} | |
} | |
}, | |
"definitions": {}, | |
"parameters": {}, | |
"responses": {}, | |
"securityDefinitions": { | |
"oauth2_auth": { | |
"type": "oauth2", | |
"flow": "accessCode", | |
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", | |
"tokenUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/token", | |
"scopes": { | |
"https://outlook.office.com/tasks.readwrite": "https://outlook.office.com/tasks.readwrite" | |
} | |
} | |
}, | |
"security": [ | |
{ | |
"oauth2_auth": [ | |
"https://outlook.office.com/tasks.readwrite" | |
] | |
} | |
], | |
"tags": [] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code it related to this blog post: https://www.aaron-powell.com/posts/2017-10-09-flow-hibp-todo/