sp-dev-fx-webparts/samples/react-manage-o365-groups/Power Automate Flow/Logic Apps Template/Join Private Group.json

1 line
9.1 KiB
JSON
Raw Normal View History

{"$schema":"https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion":"1.0.0.0","parameters":{"logicAppName":{"type":"String","metadata":{"description":"Name of the logic app."}},"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":"Location of the logic app."}},"office365_Connection_Name":{"defaultValue":"office365","type":"String","metadata":{"description":"Name of the connection."}},"approvals_Connection_Name":{"defaultValue":"approvals","type":"String","metadata":{"description":"Name of the connection."}}},"resources":[{"type":"Microsoft.Logic/workflows","apiVersion":"2016-06-01","name":"[parameters('logicAppName')]","location":"[parameters('logicAppLocation')]","dependsOn":["[resourceId('Microsoft.Web/connections', parameters('office365_Connection_Name'))]","[resourceId('Microsoft.Web/connections', parameters('approvals_Connection_Name'))]"],"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":{"manual":{"type":"Request","kind":"Http","inputs":{"schema":{"type":"object","properties":{"groupId":{"type":"string"},"groupName":{"type":"string"},"groupUrl":{"type":"string"},"requestorName":{"type":"string"},"requestorEmail":{"type":"string"}}}}}},"actions":{"Condition":{"actions":{"HTTP_-_Add_Member_to_Group":{"runAfter":{},"type":"Http","inputs":{"method":"POST","uri":"https://graph.microsoft.com/v1.0/groups/@{triggerBody()?['groupId']}/members/$ref","body":{"@@odata.id":"https://graph.microsoft.com/v1.0/users/@{triggerBody()?['requestorEmail']}"},"authentication":{"type":"ActiveDirectoryOAuth","authority":"https://login.microsoft.com","tenant":"@variables('directory_id')","audience":"https://graph.microsoft.com","clientId":"@variables('application_id')","secret":"@variables('secret')"}}},"Send_an_email_(V2)_-_Approved":{"runAfter":{"HTTP_-_Add_Member_to_Group":["Succeeded"]},"metadata":{"flowSystemMetadata":{"swaggerOperationId":"SendEmailV2"}},"type":"ApiConnection","inputs":{"host":{"connection":{"name":"@parameters('$connections')['office365']['connectionId']"}},"method":"post","body":{"To":"@triggerBody()?['requestorEmail']","Subject":"Welcome to private group - @{triggerBody()?['groupName']}","Body":"<p>Hello @{triggerBody()?['requestorName']},<br>\n<br>\nYour request to join the private group - [@{triggerBody()?['groupName']}](@{triggerBody()?['groupUrl']}) is approved.</p>"},"path":"/v2/Mail","authentication":"@parameters('$authentication')"}}},"runAfter":{"Start_and_wait_for_an_approval":["Succeeded"]},"else":{"actions":{"Send_an_email_(V2)_-_Rejected":{"runAfter":{},"metadata":{"flowSystemMetadata":{"swaggerOperationId":"SendEmailV2"}},"type":"ApiConnection","inputs":{"host":{"connection":{"name":"@parameters('$connections')['office365']['connectionId']"}},"method":"post","body":{"To":"@triggerBody()?['requestorEmail']","Subject":"Declined joining private group - @{triggerBody()?['groupName']}","Body":"<p>Hello @{triggerBody()?['requestorName']},<br>\n<br>\nYour request to join the private group - @{triggerBody()?['groupName']} is rejected.</p>"},"path":"/v2/Mail","authentication":"@parameters('$authentication')"}}}},"expression":{"equals":["@body('Start_and_wait_for_an_approval')?['outcome']","Approve"]},"type":"If"},"Initialize_variable_-_application_id":{"runAfter":{},"type":"InitializeVariable","inputs":{"variables":[{"name":"application_id","type":"String"}]}},"Initialize_variable_-_directory_id":{"runAf