-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathList-ApiConnections.ps1
39 lines (33 loc) · 1.65 KB
/
List-ApiConnections.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<#
.SYNOPSIS
List the API connections in the subscription.
.DESCRIPTION
List the set of Logic App Api connections created in your subscription. Specify the api name to just get the Api connections for that Api.
.PARAMETER ApiName
Name of the Api for which you want to see connections.
.EXAMPLE
./List-ApiConnections.ps1
List all Api connections in your subscription
.EXAMPLE
./List-ApiConnections.ps1 dropbox
List all Api connections for the dropbox api in your subscription
.NOTES
To run this script you may need to change your powershell execution policy using, for example, set-executionpolicy
#>
param([string]$ApiName)
$resources = Find-AzureRmResource -ResourceType microsoft.web/connections
if ($ApiName) {
foreach($r in $resources)
{
$robj = Get-AzureRmResource -ResourceId $r.ResourceId
if ($robj.Properties.Api.Name -like $ApiName)
{
$robj |Select-Object @{Name="Api";Expression={$_.Properties.Api.Name}}, @{Name="ConnectionName";Expression={$_.Properties.DisplayName}}, @{Name="ConnectionConfig";Expression={$_.Properties.NonSecretParameterValues}}, Name, ResourceId, ResourceName, ResourceType, ResourceGroupName, Location, SubscriptionId
}
}
} else {
foreach($r in $resources)
{
Get-AzureRmResource -ResourceId $r.ResourceId | Select-Object @{Name="Api";Expression={$_.Properties.Api.Name}}, @{Name="ConnectionName";Expression={$_.Properties.DisplayName}}, @{Name="ConnectionConfig";Expression={$_.Properties.NonSecretParameterValues}}, Name, ResourceId, ResourceName, ResourceType, ResourceGroupName, Location, SubscriptionId
}
}