Starting building Logic Apps thru the Azure Portal is, without a doubt, the most intuitive and fast approach. It doesn’t require any additional tool or software, it doesn’t require a Visual Studio license, and almost all beginner tutorials or documentation use this approach. And finally, all types of users are familiar with the Azure Portal. But not everything is perfect, and one of the most difficult best practices to implement is a proper API Connection naming convention.
When building a Logic App thru the Azure Portal, the Logic App designer doesn’t allow us to provide a proper name to the API connection. If we take, for example, the SharePoint Connector, we specify the action we want to execute, and then the designer will ask us to authenticate against the SharePoint (sign in)
After you authenticate, it will ask you to configure the select action.
And even if you try to change the connection, this will only allow you to create a new connection or select an existing one.
By default, using the Azure Portal, the name of the API Connection is the name of the connector, in this case, sharepointonline, and the display name in this connector is the user used to authenticate on the SharePoint (this can change depending on the connector you are using).
Subsequent connections will add a minus and a sequence number to the name:
- sharepointonline-1
- sharepointonline-2
These are some examples:
The main question is: How can we rename these API Connections to apply a good naming convention?
Unfortunately, by default, you can’t!
The only option you have to implement a good naming convention using the Azure Portal is to:
- Access the API Connection properties page and then select the option Automation > Export template
- Select Download
- This will download a Zip file: ExportedTemplate-<resource-group-name>.zip
- Unzip the file and open the template.json on an editor of your choice, I use Visual Studio Code.
- Find the key name parameters and inside you will find the key name connections_<connector-name>_name a little down you will find also the key name displayName inside the resource > properties.
- Change these values to what you desire, for example:
- connection name: CN-SPOnline-DVS-DEV >> this basically means Connector SharePoint Online DevScope Development Environment
- displayName: DevScope Events Folder
- Save the file and then we need to go back again to the Azure Portal.
- From the Azure portal menu, in the search box, type deploy, and then select Deploy a custom template
- Select Build your own template in the editor
- Select Load file, and then follow the instructions to load template.json you downloaded previously.
- Select Save.
- On the Custom deployment basic properties, apply the following settings:
- Subscription: Select the subscription under which this new API connection is to be created.
- Resource Group: Select an existing Resource Group or create a new one in which your function app will be created.
- And leave the Region and the connection name default values.
- Select Review + create
- Select Create
- Now if we go to our resource group you will see our new API Connection created. Select the new API Connection and then select General > Edit API connction
- Then select Authorize
- Now that our API Connection is fully functional, what we will need to do is go back to our Logic App and change our SharePoint Online connection
After that, we can delete the previous one: sharepointonline.
Unfortunately, it is a lot of manual configurations, and we need to do these steps for every connector we use on our Logic App. If we want to implement a good naming convention, something I will definitely recommend you to do.
What are the alternatives?
You have two alternatives:
- If you still want to use the Azure Portal, I recommend having a pre-prepared template for each connector. Instead of creating the connection through the Logic App designer, you create them using the custom template outside the Logic App designer. Then is just select an existing one on the Logic App designer.
- If you are open to developing outside the Azure Portal, I will definitely advise you to develop in Visual Studio (not code)