Jump to content

Logic App Standard Flow History Cleaner


Recommended Posts

Guest Mohammed_Barqawi
Posted

Flow History Cleaner

 

 

Application that deletes the Tables and the Queues in the Logic app Standard storage account.

 

it will help you in the development process, especially if there are stuck flows in the running state

 

How to download the application

 

 

Open the Kudo Kudu service overview - Azure App Service from Logic app site

 

Then chose CMD

 

 

 

mediumvv2px400.png.4b6a7117135b9a0d02fc35c2b9cf8aab.png

 

 

 

Execute the below command to clone the GitHub repository

 

 

 

git clone GitHub - mbarqawi/FlowHistoryCleaner

 

 

 

 

 

the above commend will create a folder

 

FlowHistoryCleaner

 

Then you will have to publish the solution to be able to use the executable

 

 

 

 

 

Cd FlowHistoryCleaner

dotnet publish

Cd FlowHistoryCleaner\bin\Debug\netcoreapp3.1\publish

FlowHistoryCleaner.exe

 

 

 

 

 

 

 

You need to set the environment variable DOTNET_ADD_GLOBAL_TOOLS_TO_PATH to false to be able to run the dotnet publish on the Kudu

 

 

mediumvv2px400.png.014c53c7b6bc9f20782c0c58f31b63c8.png

 

How to Run it

 

 

Make sure that the site is stop Run the command FlowHistoryCleaner.exe in the CMD to start the cleaning process

 

How Code works

 

 

The code is a .net core application it extracts the storage account connection string from the environment variables

 

 

 

 

 

 

 

string conn_str = Environment.GetEnvironmentVariable("AzureWebJobsStorage");

 

 

 

 

 

 

 

Then list all the tables and delete them

 

 

 

 

 

 

 

var TserviceClient = new TableServiceClient(conn_str);

Pageable<TableItem> queryTableResults = TserviceClient.Query();

foreach (TableItem table in queryTableResults)

{

TserviceClient.DeleteTable(table.Name);

Console.WriteLine($"-Table {table.Name}");

}

 

 

 

 

 

 

 

Then list all Queues and delete them

 

 

 

 

 

 

 

QueueServiceClient QserviceClient = new QueueServiceClient(conn_str);

 

//list all queues in the storage account

var myqueues = QserviceClient.GetQueues().AsPages();

//then you can write code to list all the queue names

foreach (Azure.Page<QueueItem> queuePage in myqueues)

{

foreach (QueueItem q in queuePage.Values)

{

QserviceClient.DeleteQueue(q.Name);

//Console.WriteLine($"-Queue {q.Name}" );

 

}

 

}

 

 

 

 

 

 

 

GitHub page

 

 

 

 

mbarqawi/FlowHistoryCleaner (github.com)

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...