Rajendra Gupta
Requirements Workflow - Azure Logic App

Azure Automation: Publish LinkedIn posts and tweets automatically using Azure Logic Apps

May 25, 2021 by

This article implements Azure Automation logic for automatically publishing a LinkedIn post and Twitter’s Tweet using the simplified Azure Logic App.


I am a technical writer publishing blogs on various topics for SQLShack. You need to work on various social platforms such as LinkedIn, Twitter, Facebook, and Instagram to share your articles so that it has a widespread and community member can benefit from it. Usually, you need to manually go on each social platform and share your article with a custom text. Manually, it takes some effort, and you might miss posting articles on a social site if you get occupied in other things.

Therefore, I thought of creating an automatic process. Once an article gets published on SQLShack, I enter a record in my Azure SQL Database table. My requirements for automation in this article are as below.

Requirements Workflow - Azure Logic App

  • I insert a new row is into the Azure SQL Database table, which triggers a workflow for the Azure logic app
  • This workflow automatically publishes the post on LinkedIn with a hashtag and post URL
  • It also submits a Tweet in the Twitter application

In this article, we implement the automation of LinkedIn posts and Tweets using the Azure Logic App.


I would assume that you have access to the Azure portal in this article. You also require an Azure SQL Database for creating tables, stored procedures for providing inputs. You can refer to SQL Azure articles and configure an active instance of the Azure database.

You also require SQL Server Management Studio (SSMS) or Azure Data Studio to connect with Azure SQL and execute queries in it.

Steps for Azure Automation technique for automating LinkedIn Post and Tweet in the Twitter application

In my earlier articles, we discussed the Azure Logic app for the automation of the following tasks.

  • Automatically upload email attachments into Azure Storage Account and import them into the Azure database
  • Automatic Scale up and down Azure SQL database with Logic Apps
  • Analyze twitter sentiments using Azure Logic Apps and store Tweets into Azure SQL Database

For this article, I created the [AutomaticPostonSocialMedia] logical app in the Azure portal. You can navigate to Azure Portal -> Logical apps -> Create a new logical app.

Azure Automation technique

Click on Edit. We will implement the following workflow using the azure logic app for this article.

Click on Edit.

Let’s look at the individual component of the configured logic app in detail.

Step 1: When an item is created (V2)

In the logic app templates, select the Blank Logic app template.

When an item is created (V2)

As we started our requirement that once we add a new row in the Azure SQL database, it should trigger the workflow. Therefore, search for SQL Server connector and click on When an item is created (V2).

Azure SQL database connector

Before we proceed, you can create a table in the Azure SQL database with the following script.

Add details for your Azure database connection such as SQL Server name, SQL database name, credentials.

create a table

Click on Create and select server, database and table name in the next window.

select server, database and table name

By default, it checks every 3 minutes for the new items in the SQL table. You can adjust it per your requirement. Click on Add new parameter and select the Top Count field.

Add new parameter

Enter the top count as 1.

Enter the top count

Step 2: Execute stored procedure (V2)

Click on Add new Step and select Execute stored procedure (V2) from the SQL Server connector. For this step, I created the stored procedure that retrieves the latest record from the table.

In the Execute stored procedure (V2) section, select the SP created for extracting the latest record from the SQL table.

Execute stored procedure (V2)

Step 3: Initialize Variable

In this step, we define a variable for preparing our LinkedIn post content using the CONCAT function. Search and select variables in the logic app connector. In the corresponding action, we will use the Initialize variable. In the Initialize variable, enter the following details.

  • Name: Enter the name as Body
  • Type: Select the type of variable. Here, we require a string variable
  • Value: In this value, enter the following CONCAT() function. It concatenates strings for content body and hashtag using the dynamic content fields

You can choose the CONCAT() function and select the required fields for preparing the above formula.

Initialize Variable

In the Initialize Variable, we enter the value as we specified above.

enter the value using an expression

Step4: Add a LinkedIn connector

Until now, we implemented logic to detect any new row in the azure database table and fetching details of a recently added row using a stored procedure.

Now, search for a LinkedIn V2 connector. It has the following listed actions.

  • List my companies V2(preview)
  • Share a company update 2(preview)
  • Share an article 2(preview)

Add a LinkedIn connector

Here, we select the action – Share an article V2 (preview). It asks for your LinkedIn credentials and permissions to access, post articles on your profile.

Share an article V2 (preview)

In the content URL, select the ResultSets Table from the dynamic content. It switches to a For each container as shown below.

ResultSets Table from the dynamic content.

Next, click in Share an article V2 (preview) and do the following column mappings.

  • Visible to guest: Yes
  • Title: ResultSets Topic
  • Description: Enter the following expression in the description field

  • Subject: ResultSets HashTags
  • Text: Variable named Body that defined in step 3

Expression in the description

Step 5: Add Twitter connector

As per our requirement, we want to post a LinkedIn post as well as Tweet automatically. In the previous step, we configure a LinkedIn post. Now, look for a Twitter connector and add it to the logic app.

Add Twitter connector

The azure logic app also requires your credentials and permissions for using Twitter and do the tasks such as Get followers, Get home timeline, Get user, Post a tweet, Retweet, search tweets.

Click on Post a tweet, and you get the following configuration window.

Post a tweet

In the add new parameter, select Tweet Text from the drop-down list. Now, enter the following expression of the CONCAT() string function. It prepares a concatenated string from the Body variable and URL from the SQL table. You can also configure a variable for storing your tweet content.

Validate LinkedIn post and Tweet

We have completed the Azure Automation using the Azure logic app’s configuration for automatically post a LinkedIn post and Tweet once a new entry comes in the Azure SQL Database table.

Validate LinkedIn post and Tweet - Azure Logic App

Click on Save and Run. The Logic app waits for a new row in the [PublishSQLShackContent] table of [labazuresql] azure database.

Wait for a post

Now, insert a row into the [PublishSQLContents] table with the following query. It puts an entry for my existing article already published on SQLShack.

Once the logic app detects a new row in the table, it triggers the logic app’s workflow. As shown below, all the steps are completed successfully within a few seconds.

insert a row

LinkedIn post validation

It’s time for validations. Open your LinkedIn profile, and you can see a recent post in my profile. It is automatically published by the Azure logic app configuration. It also has a corresponding hashtag in the LinkedIn post.

LinkedIn post validation

In the LinkedIn notification as well, you get a message that your post was shared successfully.

View Notification

Twitter’s Tweet validation

Similarly, you can find a new Tweet in my profile published by the logic app workflow.

Tweeter's Tweet validation


Azure Logic App workflow allows you to automate things quickly and efficiently. You can use multiple connectors for data integration, implementing business logic. In this article, we use Azure Automation for posting a LinkedIn post and Tweet automatically. Therefore, next time, you do not manually post the same thing on multiple social platforms. You can quickly automate things, and the logic app takes care of task implementation.

Table of contents

Azure Automation: Export Azure SQL Database to Blob Storage in a BACPAC file
Azure Automation: Create database copies of Azure SQL Database
Azure Automation: Automate Azure SQL Database indexes and statistics maintenance
Azure Automation: Automate Pause and Resume of Azure Analysis Services
Azure Automation: Automate data loading from email attachments using Azure Logic Apps
Azure Automation: Building approval-based automated workflows using Azure Logic Apps
Azure Automation: Auto-scaling Azure SQL database with Azure Logic Apps
Azure Automation: Analyzing Twitter sentiments using Azure Logic Apps
Azure Automation: Use Azure Logic Apps to import data into Azure SQL Database from Azure Blob Storage
Azure Automation: Publish LinkedIn posts and tweets automatically using Azure Logic Apps
Azure Automation: Export Azure SQL database data to CSV files using Azure Logic Apps
Azure Automation: Translate documents into different languages using Cognitive Services with Azure Logic Apps
Azure Automation: Azure Logic Apps for face recognition and insert its data into Azure SQL Database
Azure Automation: Automatic scaling Azure SQL databases based on CPU usage threshold
Rajendra Gupta
Latest posts by Rajendra Gupta (see all)