PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, September 26, 2022

[FIXED] How do I perform health-check for on premises IIS app behind firewall using Azure DevOps release pipeline

 September 26, 2022     azure-devops, azure-devops-pipelines, azure-pipelines-release-pipeline, continuous-deployment, health-monitoring     No comments   

Issue

What do I have?

I have already setup deployment of my ASP.NET Core app to my IIS. The IIS app itself is not visible from internet, because it is behind firewall.

Question

How can I ping my app from the server where it is running (so that it will perform HTTP GET to localhost) and report back to Azure DevOps? Ideally using existing Task

I could probably write some PowerShell, but I would really like to use exiting solution


Solution

As of this time, however, I'm afraid there isn't a built-in task can perfectly solve your question.

There is an Invoke REST API task that can invoke HTTP APIs and parse the response. But this task can be used in only an agentlees job, in other words, you cannot use this task unless you set your firewall to allow access from Azure DevOps.

Update: Using PowerShell task

Prerequisites: You need to use self-hosted agent so that you can access your application within your firewall.

The following is demonstrated using YAML pipeline. The steps for classic UI pipeline is roughly the same.

If you just want to get the response body:

Just use a Powershell task and send your web request:

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      ...
      Invoke-RestMethod ...

If you want to save the response body as a variable:

Step 1. Set a variable:

variables:
  result: null

Step 2. Use the PowerShell task to send a HTTP request and update the variable:

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      ...
      $response = Invoke-RestMethod ...
      Write-Host "##vso[task.setvariable variable=result;]$response"

Step 3. Then the value of $($env:RESULT) is the response body of your web request, and you can use it in subsequent tasks.



Answered By - Jane Ma-MSFT
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing