W
wernerrall
Introduction
In today's fast-paced technological landscape, cloud integration and automation have ascended as twin pillars of modern business efficiency. Microsoft's Azure and Power Automate are two titans in this arena, each offering a unique set of capabilities. But what if we could marry the vast cloud resources of Azure with the intuitive workflow automation of Power Automate? In this article, we'll embark on a digital journey to explore how you can seamlessly call Azure Resource APIs from Power Automate, unlocking new vistas of potential for your business processes. Whether you're an Azure aficionado, a Power Automate pro, or someone just stepping into the cloud, strap in and let's dive deep into this integration!
High Level Overview
We recently created an application that uses PowerApps, DevOps and Azure to build Resources like Virtual Machines. This is explained in my previous article Automating Azure VM Deployment. One of the issues we came across was populating the SharePoint with the correct Parameter Values that we can query from PowerApps and Power Automate. We wanted the Virtual Network and Subnet Values so that users can choose which Virtual Network their Azure Resources will be placed in.
I am a massive fan of using Azure Resource Graph and I knew I could get the values using the below query.
resources
| where type == 'microsoft.network/virtualnetworks'
| extend vnet_name = name
| mv-expand subnets = properties.subnets
| project vnet_name, subnet_name=subnets.name, subscriptionId
The results would look like this:
But how can I use the above information in my PowerAutomate?
Luckily there are some awesome Azure Resource Graph APIs I can call as well as passing in a query like above!
You can read more at Azure Resource Graph REST API Documentation
Prerequisites:
1. An Azure App Service Principal with Permissions to the Azure Resources you need to access (see Quickstart Register an App)
2. Access to a Power Automate Environment
Step 1: Create a new Flow with the HTTP Request Action
Step 2: Fill in the details
Method: POST
URI: https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01
Body: (Replace the #TODO below with your Azure Management Groups)
{
"managementGroups": [
"#TODO",
"#TODO"
],
"query": "resources | where type == 'microsoft.network/virtualnetworks' | extend vnet_name = name | mv-expand subnets = properties.subnets | project vnet_name, subnet_name=subnets.name, subscriptionId"
}
Step 3: Click "Show Advanced options" and complete the below fields.
Step 4: Run a Test
Closing
As you can see, we now have the JSON Response that contains the data we want. We can now insert these values into SharePoint or re-use them somewhere else. Have fun!
Disclaimer
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts or Power BI Dashboards are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts or Power BI Dashboards be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
Continue reading...
In today's fast-paced technological landscape, cloud integration and automation have ascended as twin pillars of modern business efficiency. Microsoft's Azure and Power Automate are two titans in this arena, each offering a unique set of capabilities. But what if we could marry the vast cloud resources of Azure with the intuitive workflow automation of Power Automate? In this article, we'll embark on a digital journey to explore how you can seamlessly call Azure Resource APIs from Power Automate, unlocking new vistas of potential for your business processes. Whether you're an Azure aficionado, a Power Automate pro, or someone just stepping into the cloud, strap in and let's dive deep into this integration!
High Level Overview
We recently created an application that uses PowerApps, DevOps and Azure to build Resources like Virtual Machines. This is explained in my previous article Automating Azure VM Deployment. One of the issues we came across was populating the SharePoint with the correct Parameter Values that we can query from PowerApps and Power Automate. We wanted the Virtual Network and Subnet Values so that users can choose which Virtual Network their Azure Resources will be placed in.
I am a massive fan of using Azure Resource Graph and I knew I could get the values using the below query.
resources
| where type == 'microsoft.network/virtualnetworks'
| extend vnet_name = name
| mv-expand subnets = properties.subnets
| project vnet_name, subnet_name=subnets.name, subscriptionId
The results would look like this:
But how can I use the above information in my PowerAutomate?
Luckily there are some awesome Azure Resource Graph APIs I can call as well as passing in a query like above!
You can read more at Azure Resource Graph REST API Documentation
Prerequisites:
1. An Azure App Service Principal with Permissions to the Azure Resources you need to access (see Quickstart Register an App)
2. Access to a Power Automate Environment
Step 1: Create a new Flow with the HTTP Request Action
Step 2: Fill in the details
Method: POST
URI: https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01
Body: (Replace the #TODO below with your Azure Management Groups)
{
"managementGroups": [
"#TODO",
"#TODO"
],
"query": "resources | where type == 'microsoft.network/virtualnetworks' | extend vnet_name = name | mv-expand subnets = properties.subnets | project vnet_name, subnet_name=subnets.name, subscriptionId"
}
Step 3: Click "Show Advanced options" and complete the below fields.
Step 4: Run a Test
Closing
As you can see, we now have the JSON Response that contains the data we want. We can now insert these values into SharePoint or re-use them somewhere else. Have fun!
Disclaimer
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts or Power BI Dashboards are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts or Power BI Dashboards be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
Continue reading...