Using PowerShell to manage API Connections
Logic Apps now has Managed APIs that are hosted by the service. To use one of them in a logic app all you need to do is create a connection that saves the authentication, consent and configuration to an API. For example, a connection can remember your authentication and consent into dropbox and twitter as well as save the authentication and configuration details for SMTP and FTP. After a connection is created it can also be referenced by other logic apps in the same resource group.
Although connections allow for a simple way to store your authentication and configuration we haven't yet created a portal experience to manage those connections. In the meantime you can either use the ARM REST API or PowerShell cmdlets to do CRUD operations on the microsoft.web/connections resource-type in your subscription. To help I have created a List-ApiConnections PowerShell script in GitHub that will list all of the connections in your subscription. Calling the script with the name of an API will list the connections for a particular API and calling the script without any parameters will return all of the connections in your subscription.
PS C:\Users\klam> F:\projects\List-ApiConnections.ps1 dropbox
Api : dropbox
ConnectionName : kbox@gmail.com
ConnectionConfig :
Name : 015F916D-D3FE-4F7B-B524-D8D627E38C3C
ResourceId : /subscriptions/77e6577e-2ca2-48ba-a8a7-6a3a64642e27/resourceGroups/logic-eastrg/providers/Microsoft.Web/connections/015F916D-D3FE-4F7B-B524-D8D627E38C3C
ResourceName : 015F916D-D3FE-4F7B-B524-D8D627E38C3C
ResourceType : Microsoft.Web/connections
ResourceGroupName : logic-eastrg
Location : eastus
SubscriptionId : 77e6577e-2ca2-48ba-a8a7-6a3a64642e27
To clean up a connection you can use the resourceId from the results of that list and call remove-azureRmResource -resourceId {connection-resourceId} .
PS C:\Users\klam> Remove-AzureRmResource -ResourceId /subscriptions/77e6577e-2ca2-48ba-a8a7-6a3a64642e27/resourceGroups/logic-eastrg/providers/Microsoft.Web/connections/015F916D-D3FE-4F7B-B524-D8D627E38C3C
Comments
- Anonymous
July 28, 2016
Would it be possible for me to use the existing connections for dropbox and ftp referenced in LogicAPP template?- Anonymous
July 31, 2016
Yes - but currently it requires connections be in the same resource group - so as long as you are referencing in the same resource group it's fine. You can make connections a part of a deployment though using our visual studio tools (http://aka.ms/logicapps-visualstudio) or through this document here: https://azure.microsoft.com/en-us/documentation/articles/app-service-logic-create-deploy-template/- Anonymous
August 02, 2017
how can i create a new API connection using Powershell. I am trying to create a Twitter connection
- Anonymous
- Anonymous