top of page
  • Writer's pictureYash Agarwal

Automate Azure Infrastructure deployments with Power Automate

In this #PowerShot, we will look at how to setup a Power Automate based solution to automate Azure Infrastructure Deployments. The setup involves approval workflows based on which the deployments can be triggered.


Let's Get Started!


In cases where new members onboard a team and azure resources are required, the on-boarding processes are usually manual and are time consuming. To address this, we will be creating a flow that is triggered when the team manager sends an email to the IT admin requesting an azure resource for their team member. The required information is extracted from the email and an approval request is sent to the admin or the business unit manager for further approval. Once approved, a template (pre-created and stored in the company repository) is validated and a deployment is submitted. Once the deployment of the template is successful and the resource is provisioned, an email with the details of the resource is sent to the requester.


Azure ARM Templates


Azure Resource Manager (ARM) templates are a way of deploying infrastructure as a code to Azure. Using the Azure Resource Manager connector in Power Automate, an ARM template for an azure resource (e.g., storage accounts, logic apps, virtual machines etc.) can be validated and a deployment can be submitted and managed. In this post, we will be looking at provisioning a storage account in Azure using ARM templates, Power Automate and approvals.


Check out azure quick-start ARM templates here.

 

Power Automate


Step 1: Trigger: When an email arrives- To trigger the flow when an email request for the Azure Resource arrives.


Step 2: Action: Compose- To trim the subject line of the email and get the desired text output (resource in this case). Expression used in this action is:


last(split(triggerBody()?['subject'],' - '))


Step 3: Action: Start and wait for an Approval- To create an approval based on the information from the email and request approval from the admin/ manager.

Step 4: Control: Condition- to check if the request was approved.


//No Branch Starts


Step 5: Action: Send an email- to notify the requester that the approval has been rejected.


//No Branch Ends


//Yes Branch Starts


Step 6: Action: Validate a template deployment- to validate the ARM template for the requested azure resource before initiating a deployment.

Step 7: Control: Condition- to check if the template validation was successful.


//Yes Branch for condition 2


Step 8: Action: Create or update a template deployment- to create and submit the deployment for the azure resource (storage account in this example).

Step 9: Action: Read a template deployment- to verify if the template deployment submitted in the previous action was successful and if the resource was deployed.


Step 10: Action: Parse JSON- to parse the outputs from the template deployment action and extract the details of the deployed resource (the outputs depend on the ARM template)


Step 11: Action: Send an email- to notify the requester with details of the provisioned resource.


//Yes Branch condition 2 ends

//Yes Branch Ends

 

Setup in Action

 

In this post, we saw how to automate azure resource manager template deployments based on approvals and emails using Power Automate. Similarly flows can be setup to perform actions on azure resources, provision new resources and etc. using the Azure Resource Manager connector or the ARM REST API.


More on Azure and Power Platform integration in this video here.


I hope you found this interesting and it helped you. Thank you for Reading!

Recent Posts

See All
bottom of page