Unable to deploy to Azure Linux Web App using Step 'Deploy an Azure Web App'


(Manuel Ruf) #1

I have created a Web App on Azure with the following parameters:
OS: Linux
Publish: Code
Runtime Stack: .NET Core 2.1

When I try to deploy a Release using the step ‘Deploy an Azure Web App’ to my web app I get an error (see below).
According to various articles I’ve read, it should be possible to Web Deploy to a Linux Web App.

If I run the same step against a Windows Web App it works just fine.
I have added the app settings property WEBSITE_WEBDEPLOY_USE_SCM=false to the web app but that didn’t have any effect.
We are using Octopus Server v2018.9.9. Do I need to ensure that Calamari is up to date as well?

This is quite annoying since we would like to move our deployments from using FTP in VSTS directly to Octopus.

Error (web app name redacted):
Microsoft.Web.Deployment.DeploymentDetailedException: Could not connect to the remote computer (“WEB-APP-NAME.scm.azurewebsites.net”) using the specified process (“Web Management Service”) because the server did not respond. Make sure that the process (“Web Management Service”) is started on the remote computer. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC. —> System.Net.WebException: The remote server returned an error: (405) Method Not Allowed.
November 20th 2018 16:10:11
Error
at System.Net.HttpWebRequest.GetResponse()
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.AgentClientProvider.GetHttpResponseHelper(HttpWebRequest request)
November 20th 2018 16:10:11
Error
— End of inner exception stack trace —
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.AgentClientProvider.GetHttpResponseHelper(HttpWebRequest request)
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.AgentClientProvider.GetHttpResponse(HttpWebRequest request)
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.AgentClientProvider.PerformHeadRequestHelper(Boolean getVersionInfo, Version& maximumSupportedVersion, Version& minimumSupportedVersion)
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.AgentClientProvider…ctor(DeploymentProviderContext providerContext, DeploymentBaseContext baseContext, String serverVersion)
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.DeploymentManager.CreateObjectPrivate(DeploymentProviderContext providerContext, DeploymentBaseOptions baseOptions, DeploymentObject sourceObject, String serverVersion)
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)
November 20th 2018 16:10:11
Error
at Calamari.Azure.Deployment.Conventions.AzureWebAppConvention.DeployToAzure(RunningDeployment deployment, AzureTargetSite targetSite, CalamariVariableDictionary variables, SitePublishProfile publishProfile)
November 20th 2018 16:10:11
Error
at Calamari.Azure.Deployment.Conventions.AzureWebAppConvention.Install(RunningDeployment deployment)
November 20th 2018 16:10:11
Error
at Calamari.Deployment.ConventionProcessor.RunInstallConventions()
November 20th 2018 16:10:11
Error
at Calamari.Deployment.ConventionProcessor.RunConventions()
November 20th 2018 16:10:11
Error
Running rollback conventions…
November 20th 2018 16:10:11
Error
Could not connect to the remote computer (“WEB-APP-NAME.scm.azurewebsites.net”) using the specified process (“Web Management Service”) because the server did not respond. Make sure that the process (“Web Management Service”) is started on the remote computer. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.
November 20th 2018 16:10:11
Error
Microsoft.Web.Deployment.DeploymentDetailedException
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.AgentClientProvider.GetHttpResponseHelper(HttpWebRequest request)
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.AgentClientProvider.GetHttpResponse(HttpWebRequest request)
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.AgentClientProvider.PerformHeadRequestHelper(Boolean getVersionInfo, Version& maximumSupportedVersion, Version& minimumSupportedVersion)
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.AgentClientProvider…ctor(DeploymentProviderContext providerContext, DeploymentBaseContext baseContext, String serverVersion)
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.DeploymentManager.CreateObjectPrivate(DeploymentProviderContext providerContext, DeploymentBaseOptions baseOptions, DeploymentObject sourceObject, String serverVersion)
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)
November 20th 2018 16:10:11
Error
at Calamari.Azure.Deployment.Conventions.AzureWebAppConvention.DeployToAzure(RunningDeployment deployment, AzureTargetSite targetSite, CalamariVariableDictionary variables, SitePublishProfile publishProfile)
November 20th 2018 16:10:11
Error
at Calamari.Azure.Deployment.Conventions.AzureWebAppConvention.Install(RunningDeployment deployment)
November 20th 2018 16:10:11
Error
at Calamari.Deployment.ConventionProcessor.RunInstallConventions()
November 20th 2018 16:10:11
Error
at Calamari.Deployment.ConventionProcessor.RunConventions()
November 20th 2018 16:10:11
Error
at Calamari.Azure.Commands.DeployAzureWebCommand.Execute(String[] commandLineArguments)
November 20th 2018 16:10:11
Error
at Calamari.Program.Execute(String[] args)
November 20th 2018 16:10:11
Error
–Inner Exception–
November 20th 2018 16:10:11
Error
The remote server returned an error: (405) Method Not Allowed.
November 20th 2018 16:10:11
Error
System.Net.WebException
November 20th 2018 16:10:11
Error
at System.Net.HttpWebRequest.GetResponse()
November 20th 2018 16:10:11
Error
at Microsoft.Web.Deployment.AgentClientProvider.GetHttpResponseHelper(HttpWebRequest request)
November 20th 2018 16:10:11
Fatal
The remote script failed with exit code 100


(Mark Siedle) #3

Hi Manuel,

Thanks for getting in touch.

We were able to reproduce this error message, and when we looked at the log stream on the Azure App Service it was reporting the same as this stack trace:

(405) Method Not Allowed

Can you confirm if you can deploy to this Linux App Service from Visual Studio’s right-click publish? We were not able to see our linux services in the dropdowns from Visual Studio, so we suspect they have a separate deployment mechanism for this O/S.

As you’ve already found, the official docs from Microsoft do say that you can deploy using web-deploy, but we’ve been unable to get this to work by setting that variable as well.

We have an existing GitHub issue here that you can track to be notified when a fix is available (or our investigations prove that this is not possible). We’d recommend adding comments to this issue about your particular use case and what you’re hoping to see (I.e. web-deploy vs FTP and/or zip deployments)

Sorry for the bad news.

Cheers
Mark


(Manuel Ruf) #4

Hey Mark

Thanks for getting back to me so quickly.

Apparently Visual Studio deployment to Linux Web Apps doesn’t work either but that was never an option for us anyway.

Deploying via FTP is not really an option since that would mean that I have to “hardcode” the target Web App name in the “FTP Deployment Step” which is not feasible since we have to deploy the same apps to multiple environments and tenants.
The “Tenant-Environment-Role” approach that the Azure Deploy Step offers decouples that very nicely since it makes the mapping of environment to target machine transparent to the deployment process.

Is there any way I can resolve the target machine via a role in other steps than ‘Deploy an Azure Web App’, eg the ‘Azure PowerShell Script’ step?

Thanks in advance,
Manuel


(Mark Siedle) #5

Hi Manuel,

In terms of resolving the target machine, you can change the Execution Location of an Azure PowerShell Script step to “Run on the Octopus Server on behalf of each deployment target” then select the role you wish. But keep in mind the Azure PowerShell Script step will authenticate based on the account selected on the step, not that target machine, so that may not do what you’re hoping for.

Since Octopus version 2018.9.7, you can also enable legacy mode on the Azure Web App step and transfer the account/web-app selection to the step itself, removing the targets and keeping all the details within the step. See this issue for details.

In terms of getting the contents of a referenced NuGet package in an Azure PowerShell Script step (if that’s a direction you’re considering), this documentation on Accessing Package References from a Custom Script shows you some examples.

E.g. If my package is named AzureWebApp, it might look something like this:

write-host "Running on behalf of: $($OctopusParameters['Octopus.Machine.Name'])"

$extractPath = $OctopusParameters['Octopus.Action.Package[AzureWebApp].ExtractedPath'] 
write-host "Package extracted to: $extractPath"
...

Not sure if that helps, but hopefully it gives you some options to explore.

Cheers
Mark