alastairtree
alastairtree

Reputation: 4279

Change the WebDeploy port from 8172 in Azure App service

To deploy to a website running in Azure App Service using Visual Studio or Octopus Deploy, I have to be able to make outbound connections from my deployment box on port 8172. However this is blocked by my firewall.

Is there any way to change the port used for WebDeploy in App Service?

Upvotes: 1

Views: 1764

Answers (3)

Laura Liparulo
Laura Liparulo

Reputation: 2897

I tried both with WEBSITES_PORT and PORT and both with code from repository through github actions and a docker image from dockerhub (with "EXPOSE 8000" working locally). Azure wraps your applications and expose only port 80 and 443. In my case I got: github actions --> port 80 and HTTP docker image --> port 443 and HTTPS

Upvotes: 0

alastairtree
alastairtree

Reputation: 4279

Seems it is not possible so I have swapped to do the deployment with the newer ZipDeploy feature and Powershell:

$zipDestination = "/file.zip"
$apiUrl = "https://$appServiceName.scm.azurewebsites.net/api/zipdeploy"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $siteCredentials.username, $siteCredentials.password)))
$userAgent = "powershell/1.0"

Write-Host "POSTing $zipDestination to $apiUrl as user $($siteCredentials.username)"

try {
    Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -UserAgent $userAgent -Method POST -InFile $zipDestination -ContentType "multipart/form-data"
    Write-Host "Publish complete"
} catch {
    Write-Host "Publish failed"

    # Note that value__ is not a typo.
    Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__ 
    Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription

    Throw $_.Exception
}

Upvotes: 0

Sam Cogan
Sam Cogan

Reputation: 4324

No, it's not possible to change the web deploy port. This is a configuration of the underlying IIS service which is shared by all users on the same host.

Upvotes: 3

Related Questions