Self Service Solutions – Power Apps Power Automate Azure Run Book

I want to share this information that you can utilize to build real time automation using Azure Automation Accounts(Run Books).

Below is the framework that you can utilize:

  1. Create a Run book on your azure automation account

Log on to https://portal.azure.com  and go to your azure automation account.

Click on Runbooks and create a New Powershell run book

Create a powershell run book by thinking of parameters that you will accept from powerautomate (flow).

Example:

#############ADD Params#################
Param(
  [Parameter(Mandatory=$true)]
  [string]$UserPrincipalName
)
Write-Output “$UserPrincipalName”
########################################

 

You can hit test to provide parameter manually and test your run book output.

Ones you are satisfied that run book script is doing what it is desired to do then publish it.

2. You can create a Powerapp form or canvas Powerapps which will submit the userprincipalname as an example.

or any other parameter on which you want to perform the action via azure automation run book.

For example: you want to create a form for your service center that will send a WIPE for Intune user when requested by HR or Secuirty.

or you want to create a form where you accept values and assign azure windows virtual desktop.

Write parameterized Powershell to do that stuff via azure run book.

Framework will remain same for each automation:

 

Log on to flow.microsft.com, In your flow add action create a JOB

This step will show parameter first time only, if you want to modify later, you have to delete it and re-add it.

Note: Azure automation connectors are premium connectors will not be available for use on standard E3 license.

 

This step will create a JOB and execute the Azure automation run book, Wait for job should be selected as yes so that you can get the output back to your flow in real time.

Note: Runbook parameter was detected automatically, you can insert the dynamic value here which you have collected via Powerapps.

Now you should use another step to check job status.

ADD a condition in the flow as a next step to check if it is completed –> On yes get output on NO send some error email or notification.

On yes condition you can now take the output back and perform whatever cool actions you want to take.

For example if you are sending WIPE and if its completed then you can send the output back to the requester that its successfully completed.

 

I generally get the output from Azure Runbook in Json format so that I can use that in flow convert it in HTML table and send it back to requester.

If you are good at Powershell then using above framework open n number of possibilities for automation and self service solutions for your organization.

 

Thanks for reading

Tech Wizard

https://techwizard.cloud

https://syscloudpro.com/

PowerShell Cheat Book

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s