How to set Key-value pairs for Azure Runbook automation

Justin Buckley January 3, 2024

Hello! I am looking for help on how to setup key-value pairs on a Jira form that will trigger an automation to start runbook in Azure. (https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Start-runbook-in-Azure)

In this case, I want to pass the values from my form fields to Azure:
FIRSTNAME and LASTNAME are the keys that Azure is expecting... what do I need to enter in the value fields to grab the corresponding data from the form fields? 

Screenshot 2024-01-04 at 12.02.57 AM.png

1 answer

0 votes
Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 4, 2024

Hi @Justin Buckley 

The action to start runbook in Azure, is not able to use smart values (values from other fields to be used in other automation actions or conditions)

So in this case I don't see that the request you have is possible, as you only can specify a key pair in the action directly.

Justin Buckley January 4, 2024

Sorry, not sure I follow. Are you saying I can't pass the values of my form fields to Azure? Seem like that defeats the entire purpose of providing key-value pairs? 

Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 4, 2024

Hi @Justin Buckley 

In the action "start runbook in Azure" you can set defined values, but these values can't be provided by input in fields in an issue.

This can only be done by using automation smart values, but the action "start runbook in Azure", can't use smart values as stated in the documentation.

The values you can use in the action are values in Azure, as the action already requires you to connect Jira with Microsoft Azure.

So the details you can provide in the action, are values, that exist in Azure, but can't be taken from fields in Jira.

Justin Buckley January 4, 2024

@Marc - Devoteam

Thanks for clarifying. This is pretty disappointing and seems like a functional oversight to not be able to simply pass form field values to a runbook. In my case, I was hoping to create a new user account request form (amongst others) but I guess if the values don't already exist in Azure then this automation is pretty limited in scope.

I did find a way to pass some data to Azure, but it's a pain in the butt. For those interested.

https://community.atlassian.com/t5/Jira-Service-Management-articles/Reading-a-Forms-ProForma-field-value-without-the-JSON-tab/ba-p/2097012

ian
Contributor
June 19, 2024

Hello @Justin Buckley "functional oversight" is an understatement!

I've just discovered that I can't use variable/smart values. I don't understand the "values, that exist in Azure" comment from Marc. Why does the value need to exist in Azure (rhetorical). My runbooks have mandatory typed parameters which match the key/value pairs in the Jira automation. I can enter any value of the correct type into these parameters when I manually run the runbook so why can't I send a variable/smart-value through the automation rule.

If I send the wrong value/type, then that's on me. It's a one-way integration afaik so not sure why Jira would care what value I send through the automation. The cynic in me thinks that Atlassian are angling to make this an Enterprise feature.

Sorry for the rant. Will take a look at your link and see if I can use that. Thanks for posting.

ian
Contributor
June 19, 2024

@Justin Buckley - did you investigate using a runbook webhook with the Jira 'send web request' action? This looks like it might work but have only skimmed the details so far.

ian
Contributor
June 19, 2024

Fwiw, in case someone else stumbles across this, a Jira 'Send web request' action to an Azure runbook webhook is working for me. In my basic test, I'm specifying custom data in the Jira request body:

[ {"upn" : "{{reporter.emailAddress}}", "task" : "remove"} ]

My PowerShell 7.2 runbook takes this and adds/removes the reporter from an Azure Ad group using the Microsoft Graph.

It should be easy to extend this to more complex processes. 

Scott Holland June 28, 2024

@ian do you think you would be able to pass a ticket number to the webhook? I just discovered this as an option for automation and am looking to run some commands on tickets as they come in but, not sure how to pass the issue key to the webhook.

ian
Contributor
June 28, 2024

@Scott Holland You can find Jira Cloud automation smart values here: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/

I think you want {{issue.key}}.

You should be able to pass any of these smart values to the runbook webhook in JSON format. You can technically pass all the ticket values as JSON but I've found it easier in the runbook to deal with just the values I need. 

Your comment "run some commands on tickets" has me wondering if you realise this is one direction: Jira to Azure. If you want the runbook to do something with Jira tickets then it would need to connect back to a Jira webhook or similar. I've not done anything in that direction because we've been able to use Jira automation to do all that we need inside our Jira environment.

We have a PowerApp that updates items in Jira Assets with properties from Azure AD but this basically uses the Assets import function. These items are surfaced in our tickets. Some of the third-party apps do this much better now so we may switch to one of them soon.

I hope that answers your qu.

Mafe Ortega
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 12, 2024

@ian i came across your comment about using the 'Send web request' action in Jira to trigger an Azure Runbook. I'm currently trying to achieve something similar — running an Azure Runbook from Jira based on information entered in forms. Could you please provide more details about how you set it up? Like, what does the Send web request configuration look like in Jira Automation (e.g., headers, body, url)? did you need to include any specific authentication setup (like Azure AD token or shared access key)?

ian
Contributor
December 12, 2024

Hello @Mafe Ortega . I've not touched this for a bit so will explain as best I can.

Add a webhook to your Azure runbook. This will generate a URL that includes a unique token. You need to copy the webhook URL before you finish creating the webhook because you cannot get it again later.

image.png

I store these in the secure vault of our password/identity management tool in case I need to refer to it again.

In your Jira automation add a 'Send web request'. Paste your Azure webhook URL in the URL field. Choose POST as the method.

In the 'Web request body' field I chose 'Custom Data' and have this in the Custom data field:

[ {"upn" : "{{reporter.emailAddress}}", "task" : "remove"} ] 

In the Azure runbook, I have one parameter like this:

 

param
(


    [Parameter(Mandatory=$false)]

    [object] $WebhookData

)
When jira posts to the webhook, $WebhookData will be in JSON format. I use the following PowerShell command to convert the JSON data into an object:
$jiraData = ConvertFrom-Json -InputObject $WebhookData.RequestBody
I can then refer to these properties in my Azure PS runbook:
$upn = $jiraData.upn

$task = $jiraData.task
In this particular case, my Azure runbook connects to Microsoft Graph and adds or removes the specified user from a Entra ID (Azure) group depending on which 'task' I specify.
I hope that helps.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events