DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Delivering Your Code to the Cloud With JFrog Artifactory and GitHub Actions
  • Migrating Spring Java Applications to Azure App Service (Part 1: DataSources and Credentials)
  • Achieving Micro-frontend Architecture Using Angular Elements
  • Microsoft Azure Active Directory

Trending

  • Four Essential Tips for Building a Robust REST API in Java
  • Event-Driven Microservices: How Kafka and RabbitMQ Power Scalable Systems
  • Distributed Consensus: Paxos vs. Raft and Modern Implementations
  • After 9 Years, Microsoft Fulfills This Windows Feature Request
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Restart Azure Web App Using Azure Logic App

Restart Azure Web App Using Azure Logic App

Learn how you easy it can be to trigger the Azure Logic app to restart the Azure web app.

By 
Harsh Gupta user avatar
Harsh Gupta
·
Sep. 19, 19 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
14.2K Views

Join the DZone community and get the full member experience.

Join For Free

restart pillows

Sometimes you have to begin again.

Introduction

In this article, we are going to see how to restart the Azure web app using Azure Logic App. I am assuming that you know about Azure Logic Apps. If you want to read more about Azure Logic Apps, check out this article.

You may also enjoy:  Introducing Azure Logic Apps Integration Service Environment (ISE)

Prerequisites

For creating a Logic App which will restart the Azure web app, you need the following items and access.

  1. Azure portal access where Azure web App is deployed.
  2. Tenant Id of your azure account
  3. Client_id
  4. Client_secret
  5. Azure Subscription Id
  6. Resource Group
  7. App name

Steps

Restarting of Azure web app using Azure logic app will have three simple steps, as shown below.

Three steps

Three steps to restarting Azure web app

We will discuss, figure 1 steps in detail in the following section.

Start Designing of the Azure Logic App

Step 1 - Get Access Token (HTTP)

Firstly, we need to add the HTTP action in-order to generate and get the access token. This action is having a post method and requires tenant_id, client_id, client_secret.

"method": "POST"

"uri": "https://login.microsoftonline.com/{tenant_id}/oauth2/token"
"body": "&client_id={client_id} &client_secret{client_secret}&://management.core.windows.net/"

"Content-Type": "application/x-www-form-urlencoded"

Get HTTP Access Token

Get HTTP Access Token


Figure 2

After execution, we will get a JSON result which will have an access_token value which is required to restart the app.

JSON result looks like as below:

JSON result

JSON result

Step 2: Parse JSON

Parse the JSON and get the body and define the schema using the sample payload to generate the schema.

Parsing JSON

Parsing JSON

Step 3 - Restart App (HTTP)

For this HTTP request, we need a subscription ID, resource group, and app name of the Azure web app. We need to pass the access_token  from the previous step in the Authorization field.

"method": "POST"

"uri": "https://management.azure.com/subscriptions/{subscription_id}/resourceGroups/{resource_group}/providers/Microsoft.Web/sites/{webApp_name}/restart?-08-01"
"Authorization": "Bearer @{body('Parse_JSON')?['access_token']}",

"Content-Type": "application/json"

Restarting application

Restarting the application

Run Logic App

Your Logic app is ready and now run this and see the results in history.

Three steps

Three steps

The Activity Log of Web App

Check the webApp activity log. You might need to wait for 1-2 mins in-order to update this.

Activity Log

Activity log

Expected Result

The Logic app is configured properly and worked as per expected. It is restarting the Azure web app, and we can configure this on-demand and schedule it. For on-demand, we can use email receiving event and restart it on receiving an email with a specific subject line. This process is presented below.

Automate the Logic App on Receiving an Email

To automate this process, we can configure the above Logic app to receive an email with some defined text in the subject. Now, whenever you will receive an email with a defined subject then the Logic app will run automatically.

Running app

Summary

In the above article, we saw how to restart the Azure web app using the logic app. We also saw how to use email receiving an event to restart the app. Apart from the restart, we can perform many more operations like stop, start, etc. For more triggered APIs, refer to the below URL and configure those in the above logic app accordingly.

Further Reading

Is Logic Apps or Durable Functions Best for Your Workflow?

Azure Logic Apps (With Demo Using YouTube and Outlook.com Connectors)

app azure Web Service

Opinions expressed by DZone contributors are their own.

Related

  • Delivering Your Code to the Cloud With JFrog Artifactory and GitHub Actions
  • Migrating Spring Java Applications to Azure App Service (Part 1: DataSources and Credentials)
  • Achieving Micro-frontend Architecture Using Angular Elements
  • Microsoft Azure Active Directory

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!