This article supports CloudRadial's open-source project for Azure Functions. Please see https://github.com/cloudradial/CloudRadialCsaAutomations for more information.
Linking an Azure Function app to a CloudRadial CSA service catalog item is not difficult once you have created the Azure Function app. Please see the README document for the CloudRadialCsaAutomations repository for the preparatory steps. Once these steps are complete, you'll create an automation under Partner > Automations, and then add the automation to the service catalog item.
Automations are included as question types so that any promptable fields are included in the form.
Here are some things to consider when linking an automation:
- Tokens are the primary way of passing information from a form to an automation. Form questions use the Script / JSON Field ID as the name of the token generated.
- Besides question tokens, you can reference any other partner or company token to pass to an automation.
- If you are creating a ticket as a part of the service catalog item, it will be created before the automation runs, and you can reference the ticket number using the token @TicketId.
- The result of an automation webhook may be passed as the input of a subsequent webhook or email.
Uniquely Identifying Question Responses
To ensure you can identify specific ticket fields in your form, specify a JSON ID for the field. This code is added to the JSON response to identify the value provided by a user. JSON IDs are under the "Show more options..." link at the bottom of a question form.
You will use the service catalog form JSON field values to pass content to webhooks or other automation steps.
Setting Up a Multi-Step Webhook Automation
The sample Azure Functions are designed around a multi-step process where the output of one webhook can feed into the input of the next. This allows an automation, linked to a service catalog item, such as the following:
- Add a Microsoft 365 user to an existing 365 group.
- Add a ticket note (to a ticket created by the service catalog item) with the result.
- Update the status of the ticket based on the success of step 1.
- Format an email message from the results of step 1 with partner markup.
- Send the output of step 4 as an email to the user requesting the item.
When you create a webhook, you can provide the webhook's body, such as the JSON formatted text, or link the output of a previous step. Please ensure the content types are consistent when passing output from one step to another.
To link the output of one step to another, use the Source option in the dialog.
Obtain the URL field from the Azure Function app using the "Get function URL" link.
Testing Your Automation
You can add a webhook step to see or validate what is passed during a webhook. The site Website Hook, https://webhook.site, provides an easy way to see what you are passing.
For validating the Azure Function app, use the Monitor section of the function. Use the Write-Host PowerShell statement to log data that helps you verify results.
Comments
0 comments
Please sign in to leave a comment.