API connections resources work as the bridges for Logic App to communicate with other services. While most of them are used to connect to cloud resources, a few of them leverage On-premises Data Gateways to connect local data sources to Azure. However, we may find that it is not easy to check which On-premises Data Gateway (OPDG) is used by which API connection resource.
Find out which On-premises Data Gateways are used by which API connection resources.
The most known way to check OPDG used by a connector is by inspecting the Logic App designer.
However, this method seems unhandy as we need to go every Logic App’s designer mode and may cause unwanted change. My preferred way is to check the sourced OPDG from the JSON definition of an API connection resource.
As we have found out that OPDG information can be extracted from the JSON definition of an API connection resource. We can use a PowerShell script to find out all API connections which is using an OPDG.
Columns:
connectionName: name of the API connection resource
connectionId: resource ID of the API connection
gatewayName: name of the On-premises Data Gateway resource
gatewatyId: resource ID of the On-premises Data Gateway
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
# If you encountered "script is not signed error", please use below comand in the PowerShell first.
# Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
# Login to your Azure Account:
Connect-AzAccount
# Put in your own subscription name:
$subsctionName = ''
Set-AzContext -SubscriptionName $subsctionName
# Get all API connection resources
$connectionList = Get-AzResource -ResourceType 'Microsoft.Web/connections'
# Loop through connection list
Write-Host '---------------------------------------'
Write-Host ' Start loop connections - Processing'
Write-Host '---------------------------------------'
$result = @()
foreach ($connection in $connectionList){
$currentConnectionObj = Get-AzResource -ResourceId $connection.ResourceId
$connectionName = $currentConnectionObj.Name
$connectionId = $connection.ResourceId
Write-Host 'Processing connection:' $connectionName
# Extract gateway information
$opdgName = $currentConnectionObj.Properties.parameterValues.gateway.name
$opdgId = $currentConnectionObj.Properties.parameterValues.gateway.id
if (!($opdgId -eq $null)){
Write-Host '------------------------------------------------'
Write-Host 'OPDG found:'
Write-Host 'Connection' $connectionName 'is using gateway' $opdgName
Write-Host '------------------------------------------------'
$new = [PSCustomObject]@{
connectionName = $connectionName
connectionId = $connectionId
gatewayName = $opdgName
gatewayId = $opdgId
}
$result += $new
}
}
# Write collected information to output.csv file
$result | Export-Csv -Path .\output.csv -NoTypeInformation
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.